# mod.ts
export function f1(val1: A | B): val1 is A {}
export function f2(val2: any): asserts val2 is string {}
export function f3(val3: any): asserts val3 {}
export function assertIsDefined<T>(val4: T): asserts val4 is NonNullable<T> {
  if (val === undefined || val === null) {
    throw new AssertionError(
      `Expected 'val' to be defined, but received ${val}`
    );
  }
}
export class C {
  isSomething(): this is Something {
    return this instanceof Something;
  }
}

# diagnostics
error[missing-jsdoc]: exported symbol is missing JSDoc documentation
 --> /mod.ts:1:1
  | 
1 | export function f1(val1: A | B): val1 is A {}
  | ^


error[missing-jsdoc]: exported symbol is missing JSDoc documentation
 --> /mod.ts:2:1
  | 
2 | export function f2(val2: any): asserts val2 is string {}
  | ^


error[missing-jsdoc]: exported symbol is missing JSDoc documentation
 --> /mod.ts:3:1
  | 
3 | export function f3(val3: any): asserts val3 {}
  | ^


error[missing-jsdoc]: exported symbol is missing JSDoc documentation
 --> /mod.ts:4:1
  | 
4 | export function assertIsDefined<T>(val4: T): asserts val4 is NonNullable<T> {
  | ^


error[missing-jsdoc]: exported symbol is missing JSDoc documentation
  --> /mod.ts:11:1
   | 
11 | export class C {
   | ^


error[missing-jsdoc]: exported symbol is missing JSDoc documentation
  --> /mod.ts:12:3
   | 
12 |   isSomething(): this is Something {
   |   ^

# output.txt
Defined in file:///mod.ts:3:1

function assertIsDefined<T>(val4: T): asserts val4 is NonNullable<T>

Defined in file:///mod.ts:0:1

function f1(val1: A | B): val1 is A

Defined in file:///mod.ts:1:1

function f2(val2: any): asserts val2 is string

Defined in file:///mod.ts:2:1

function f3(val3: any): asserts val3

Defined in file:///mod.ts:10:1

class C

  isSomething(): this is Something


# output.json
{
  "symbols": [
    {
      "name": "f1",
      "declarations": [
        {
          "location": {
            "filename": "file:///mod.ts",
            "line": 0,
            "col": 0,
            "byteIndex": 0
          },
          "declarationKind": "export",
          "kind": "function",
          "def": {
            "params": [
              {
                "kind": "identifier",
                "name": "val1",
                "optional": false,
                "tsType": {
                  "kind": "union",
                  "value": [
                    {
                      "repr": "A",
                      "kind": "typeRef",
                      "value": {
                        "typeName": "A"
                      }
                    },
                    {
                      "repr": "B",
                      "kind": "typeRef",
                      "value": {
                        "typeName": "B"
                      }
                    }
                  ]
                }
              }
            ],
            "returnType": {
              "repr": "val1 is A",
              "kind": "typePredicate",
              "value": {
                "param": {
                  "type": "identifier",
                  "name": "val1"
                },
                "type": {
                  "repr": "A",
                  "kind": "typeRef",
                  "value": {
                    "typeName": "A"
                  }
                }
              }
            },
            "hasBody": true
          }
        }
      ]
    },
    {
      "name": "f2",
      "declarations": [
        {
          "location": {
            "filename": "file:///mod.ts",
            "line": 1,
            "col": 0,
            "byteIndex": 46
          },
          "declarationKind": "export",
          "kind": "function",
          "def": {
            "params": [
              {
                "kind": "identifier",
                "name": "val2",
                "optional": false,
                "tsType": {
                  "repr": "any",
                  "kind": "keyword",
                  "value": "any"
                }
              }
            ],
            "returnType": {
              "repr": "asserts val2 is string",
              "kind": "typePredicate",
              "value": {
                "asserts": true,
                "param": {
                  "type": "identifier",
                  "name": "val2"
                },
                "type": {
                  "repr": "string",
                  "kind": "keyword",
                  "value": "string"
                }
              }
            },
            "hasBody": true
          }
        }
      ]
    },
    {
      "name": "f3",
      "declarations": [
        {
          "location": {
            "filename": "file:///mod.ts",
            "line": 2,
            "col": 0,
            "byteIndex": 103
          },
          "declarationKind": "export",
          "kind": "function",
          "def": {
            "params": [
              {
                "kind": "identifier",
                "name": "val3",
                "optional": false,
                "tsType": {
                  "repr": "any",
                  "kind": "keyword",
                  "value": "any"
                }
              }
            ],
            "returnType": {
              "repr": "asserts val3",
              "kind": "typePredicate",
              "value": {
                "asserts": true,
                "param": {
                  "type": "identifier",
                  "name": "val3"
                }
              }
            },
            "hasBody": true
          }
        }
      ]
    },
    {
      "name": "assertIsDefined",
      "declarations": [
        {
          "location": {
            "filename": "file:///mod.ts",
            "line": 3,
            "col": 0,
            "byteIndex": 150
          },
          "declarationKind": "export",
          "kind": "function",
          "def": {
            "params": [
              {
                "kind": "identifier",
                "name": "val4",
                "optional": false,
                "tsType": {
                  "repr": "T",
                  "kind": "typeRef",
                  "value": {
                    "typeName": "T",
                    "resolution": {
                      "kind": "typeParam",
                      "declaringName": "assertIsDefined",
                      "declaringKind": "function"
                    }
                  }
                }
              }
            ],
            "returnType": {
              "repr": "asserts val4 is NonNullable",
              "kind": "typePredicate",
              "value": {
                "asserts": true,
                "param": {
                  "type": "identifier",
                  "name": "val4"
                },
                "type": {
                  "repr": "NonNullable",
                  "kind": "typeRef",
                  "value": {
                    "typeParams": [
                      {
                        "repr": "T",
                        "kind": "typeRef",
                        "value": {
                          "typeName": "T",
                          "resolution": {
                            "kind": "typeParam",
                            "declaringName": "assertIsDefined",
                            "declaringKind": "function"
                          }
                        }
                      }
                    ],
                    "typeName": "NonNullable"
                  }
                }
              }
            },
            "hasBody": true,
            "typeParams": [
              {
                "name": "T"
              }
            ]
          }
        }
      ]
    },
    {
      "name": "C",
      "declarations": [
        {
          "location": {
            "filename": "file:///mod.ts",
            "line": 10,
            "col": 0,
            "byteIndex": 372
          },
          "declarationKind": "export",
          "kind": "class",
          "def": {
            "methods": [
              {
                "name": "isSomething",
                "kind": "method",
                "functionDef": {
                  "params": [],
                  "returnType": {
                    "repr": "this is Something",
                    "kind": "typePredicate",
                    "value": {
                      "param": {
                        "type": "this"
                      },
                      "type": {
                        "repr": "Something",
                        "kind": "typeRef",
                        "value": {
                          "typeName": "Something"
                        }
                      }
                    }
                  },
                  "hasBody": true
                },
                "location": {
                  "filename": "file:///mod.ts",
                  "line": 11,
                  "col": 2,
                  "byteIndex": 391
                }
              }
            ]
          }
        }
      ]
    }
  ]
}
