TypeScript/tests/baselines/reference/callbackTag2.types
Anders Hejlsberg a4f9bf0fce
Create type aliases for unresolved type symbols (#45976)
* Create type aliases for unresolved type symbols

* Accept new baselines

* Update fourslash tests

* Unresolved import aliases create tagged unresolved symbols

* Add comments

* Accept new baselines

* Add fourslash tests
2021-09-23 13:21:27 -07:00

61 lines
1.4 KiB
Plaintext

=== tests/cases/conformance/jsdoc/cb.js ===
/** @template T
* @callback Id
* @param {T} t
* @returns {T} Maybe just return 120 and cast it?
*/
var x = 1
>x : number
>1 : 1
/** @type {Id<string>} I actually wanted to write `const "120"` */
var one_twenty = s => "120";
>one_twenty : Id<string>
>s => "120" : (s: string) => string
>s : string
>"120" : "120"
/** @template S
* @callback SharedId
* @param {S} ego
* @return {S}
*/
class SharedClass {
>SharedClass : SharedClass
constructor() {
/** @type {SharedId<S>} */
this.id;
>this.id : SharedId<S>
>this : this
>id : SharedId<S>
}
}
/** @type {SharedId<number>} */
var outside = n => n + 1;
>outside : SharedId<number>
>n => n + 1 : (n: number) => number
>n : number
>n + 1 : number
>n : number
>1 : 1
/** @type {Final<{ fantasy }, { heroes }>} */
var noreturn = (barts, tidus, noctis) => "cecil"
>noreturn : Final<{ fantasy: any; }, { heroes: any; }>
>(barts, tidus, noctis) => "cecil" : (barts: { fantasy: any; }, tidus: { heroes: any; }, noctis: { heroes: any; } & { fantasy: any; }) => "cecil" | "zidane"
>barts : { fantasy: any; }
>tidus : { heroes: any; }
>noctis : { heroes: any; } & { fantasy: any; }
>"cecil" : "cecil"
/**
* @template V,X
* @callback Final
* @param {V} barts - "Barts"
* @param {X} tidus - Titus
* @param {X & V} noctis - "Prince Noctis Lucius Caelum"
* @return {"cecil" | "zidane"}
*/