# mod.ts
export function add<T>(a: T, b: T) { return a + b; }
# diagnostics
error[missing-jsdoc]: exported symbol is missing JSDoc documentation
--> /mod.ts:1:1
|
1 | export function add<T>(a: T, b: T) { return a + b; }
| ^
error[missing-return-type]: exported function is missing an explicit return type annotation
--> /mod.ts:1:1
|
1 | export function add<T>(a: T, b: T) { return a + b; }
| ^
# output.txt
Defined in file:///mod.ts:0:1
function add<T>(a: T, b: T)
# output.json
{
"symbols": [
{
"name": "add",
"declarations": [
{
"location": {
"filename": "file:///mod.ts",
"line": 0,
"col": 0,
"byteIndex": 0
},
"declarationKind": "export",
"kind": "function",
"def": {
"params": [
{
"kind": "identifier",
"name": "a",
"optional": false,
"tsType": {
"repr": "T",
"kind": "typeRef",
"value": {
"typeName": "T",
"resolution": {
"kind": "typeParam",
"declaringName": "add",
"declaringKind": "function"
}
}
}
},
{
"kind": "identifier",
"name": "b",
"optional": false,
"tsType": {
"repr": "T",
"kind": "typeRef",
"value": {
"typeName": "T",
"resolution": {
"kind": "typeParam",
"declaringName": "add",
"declaringKind": "function"
}
}
}
}
],
"hasBody": true,
"typeParams": [
{
"name": "T"
}
]
}
}
]
}
]
}