TypeScript/tests/baselines/reference/typedefTagWrapping.types
Wesley Wigham 78a99241d8
Reuse input type nodes when serializing signature parameter and return types (#37444)
* Accept change

* Accept the huge set of ever so slightly changed baselines

* Update return type logic to only reuse nodes if original nodes share scope with current node, like property types, only reuse nodes if symbols referened are acessible, reuse nodes for property signatures, too

* Only reuse nodes when a context is provided (otherwise identifier printback may fail)

* Only track symbol if symbol is found and no error is recorded

* Fix type parameter reuse lookup

* Forbid cjs module.exports references in retained nodes

* Adjust check for cjs export references to not include bad module type in output

* Add symbol to all identifiers we see in existing nodes for quickinfo

* Accept fourslash baseline updates

* Accept slightly updated baseline post-merge

* Do not copy original nodes for error types, replace empty type references with any
2020-04-01 19:50:21 -07:00

190 lines
4.8 KiB
Plaintext

=== tests/cases/conformance/jsdoc/mod1.js ===
/**
* @typedef {function(string): boolean}
* Type1
*/
/**
* Tries to use a type whose name is on a different
* line than the typedef tag.
* @param {Type1} func The function to call.
* @param {string} arg The argument to call it with.
* @returns {boolean} The return.
*/
function callIt(func, arg) {
>callIt : (func: Type1, arg: string) => boolean
>func : (arg0: string) => boolean
>arg : string
return func(arg);
>func(arg) : boolean
>func : (arg0: string) => boolean
>arg : string
}
=== tests/cases/conformance/jsdoc/mod2.js ===
/**
* @typedef {{
* num: number,
* str: string,
* boo: boolean
* }} Type2
*/
/**
* Makes use of a type with a multiline type expression.
* @param {Type2} obj The object.
* @returns {string|number} The return.
*/
function check(obj) {
>check : (obj: Type2) => string | number
>obj : { num: number; str: string; boo: boolean; }
return obj.boo ? obj.num : obj.str;
>obj.boo ? obj.num : obj.str : string | number
>obj.boo : boolean
>obj : { num: number; str: string; boo: boolean; }
>boo : boolean
>obj.num : number
>obj : { num: number; str: string; boo: boolean; }
>num : number
>obj.str : string
>obj : { num: number; str: string; boo: boolean; }
>str : string
}
=== tests/cases/conformance/jsdoc/mod3.js ===
/**
* A function whose signature is very long.
*
* @typedef {function(boolean, string, number):
* (string|number)} StringOrNumber1
*/
/**
* Makes use of a function type with a long signature.
* @param {StringOrNumber1} func The function.
* @param {boolean} bool The condition.
* @param {string} str The string.
* @param {number} num The number.
* @returns {string|number} The return.
*/
function use1(func, bool, str, num) {
>use1 : (func: StringOrNumber1, bool: boolean, str: string, num: number) => string | number
>func : (arg0: boolean, arg1: string, arg2: number) => string | number
>bool : boolean
>str : string
>num : number
return func(bool, str, num)
>func(bool, str, num) : string | number
>func : (arg0: boolean, arg1: string, arg2: number) => string | number
>bool : boolean
>str : string
>num : number
}
=== tests/cases/conformance/jsdoc/mod4.js ===
/**
* A function whose signature is very long.
*
* @typedef {function(boolean, string,
* number):
* (string|number)} StringOrNumber2
*/
/**
* Makes use of a function type with a long signature.
* @param {StringOrNumber2} func The function.
* @param {boolean} bool The condition.
* @param {string} str The string.
* @param {number} num The number.
* @returns {string|number} The return.
*/
function use2(func, bool, str, num) {
>use2 : (func: StringOrNumber2, bool: boolean, str: string, num: number) => string | number
>func : (arg0: boolean, arg1: string, arg2: number) => string | number
>bool : boolean
>str : string
>num : number
return func(bool, str, num)
>func(bool, str, num) : string | number
>func : (arg0: boolean, arg1: string, arg2: number) => string | number
>bool : boolean
>str : string
>num : number
}
=== tests/cases/conformance/jsdoc/mod5.js ===
/**
* @typedef {{
* num:
* number,
* str:
* string,
* boo:
* boolean
* }} Type5
*/
/**
* Makes use of a type with a multiline type expression.
* @param {Type5} obj The object.
* @returns {string|number} The return.
*/
function check5(obj) {
>check5 : (obj: Type5) => string | number
>obj : { num: number; str: string; boo: boolean; }
return obj.boo ? obj.num : obj.str;
>obj.boo ? obj.num : obj.str : string | number
>obj.boo : boolean
>obj : { num: number; str: string; boo: boolean; }
>boo : boolean
>obj.num : number
>obj : { num: number; str: string; boo: boolean; }
>num : number
>obj.str : string
>obj : { num: number; str: string; boo: boolean; }
>str : string
}
=== tests/cases/conformance/jsdoc/mod6.js ===
/**
* @typedef {{
* foo:
* *,
* bar:
* *
* }} Type6
*/
/**
* Makes use of a type with a multiline type expression.
* @param {Type6} obj The object.
* @returns {*} The return.
*/
function check6(obj) {
>check6 : (obj: Type6) => any
>obj : { foo: any; bar: any; }
return obj.foo;
>obj.foo : any
>obj : { foo: any; bar: any; }
>foo : any
}
=== tests/cases/conformance/jsdoc/mod7.js ===
/**
No type information for this code. Multiline type expressions in comments without leading * are not supported.
No type information for this code. @typedef {{
No type information for this code. foo:
No type information for this code. *,
No type information for this code. bar:
No type information for this code. *
No type information for this code. }} Type7
No type information for this code. */
No type information for this code.
No type information for this code.