TypeScript/tests/baselines/reference/jsdocTypeTag.types
Nathan Shively-Sanders b56093f3ac
Fix type when annotated with a JSDoc function type (#22692)
* Fix type when annotated with a JSDoc function type

Previously,
1. A variable annotated with a JSDoc function type would not require all
its parameters to be provided. This should only apply to functions
without a type annotation.
2. A parameter in a function with a JSDoc function type annotation would
still have the type 'any'.
3. Two `var` declarations in a Typescript and Javascript file,
respectively, would error even when they had identical function types.

* Update baselines and add constructor test

* Handle ConstructorType too

* Add test:method sig inside literal type

* Contextually type parameters by parent sig's JSDoc

Instead of a syntactic check in getJSDocTag

* Remove redundant check:isUntypedSignatureInJSFile

* Positive check for value signatures

Instead of excluding type signatures piecemeal.
2018-03-19 16:00:45 -07:00

166 lines
2.2 KiB
Plaintext

=== tests/cases/conformance/jsdoc/a.js ===
/** @type {String} */
var S;
>S : string
/** @type {string} */
var s;
>s : string
/** @type {Number} */
var N;
>N : number
/** @type {number} */
var n;
>n : number
/** @type {Boolean} */
var B;
>B : boolean
/** @type {boolean} */
var b;
>b : boolean
/** @type {Void} */
var V;
>V : void
/** @type {void} */
var v;
>v : void
/** @type {Undefined} */
var U;
>U : undefined
/** @type {undefined} */
var u;
>u : undefined
/** @type {Null} */
var Nl;
>Nl : null
/** @type {null} */
var nl;
>nl : null
/** @type {Array} */
var A;
>A : any[]
/** @type {array} */
var a;
>a : any[]
/** @type {Promise} */
var P;
>P : Promise<any>
/** @type {promise} */
var p;
>p : Promise<any>
/** @type {?number} */
var nullable;
>nullable : number | null
/** @type {Object} */
var Obj;
>Obj : any
/** @type {object} */
var obj;
>obj : any
/** @type {Function} */
var Func;
>Func : Function
/** @type {(s: string) => number} */
var f;
>f : (s: string) => number
/** @type {new (s: string) => { s: string }} */
var ctor;
>ctor : new (s: string) => { s: string; }
=== tests/cases/conformance/jsdoc/b.ts ===
var S: string;
>S : string
var s: string;
>s : string
var N: number;
>N : number
var n: number
>n : number
var B: boolean;
>B : boolean
var b: boolean;
>b : boolean
var V :void;
>V : void
var v: void;
>v : void
var U: undefined;
>U : undefined
var u: undefined;
>u : undefined
var Nl: null;
>Nl : null
>null : null
var nl: null;
>nl : null
>null : null
var A: any[];
>A : any[]
var a: any[];
>a : any[]
var P: Promise<any>;
>P : Promise<any>
>Promise : Promise<T>
var p: Promise<any>;
>p : Promise<any>
>Promise : Promise<T>
var nullable: number | null;
>nullable : number | null
>null : null
var Obj: any;
>Obj : any
var obj: any;
>obj : any
var Func: Function;
>Func : Function
>Function : Function
var f: (s: string) => number;
>f : (s: string) => number
>s : string
var ctor: new (s: string) => { s: string };
>ctor : new (s: string) => { s: string; }
>s : string
>s : string