TypeScript/tests/baselines/reference/jsdocTemplateTagNameResolution.js
Ron Buckton cf787e9bcf
Fix name resolution in typedef and allow defaults for template tags (#45483)
* Fix name resolution in typedef and allow defaults for template tags

* Inline parseBracketNameInTemplateTag

* Update baselines

* Add js declaration emit tests
2021-09-08 17:05:07 -07:00

31 lines
504 B
TypeScript

//// [file.js]
/**
* @template T
* @template {keyof T} K
* @typedef {T[K]} Foo
*/
const x = { a: 1 };
/** @type {Foo<typeof x, "a">} */
const y = "a";
//// [file.js]
/**
* @template T
* @template {keyof T} K
* @typedef {T[K]} Foo
*/
var x = { a: 1 };
/** @type {Foo<typeof x, "a">} */
var y = "a";
//// [file.d.ts]
declare namespace x {
const a: number;
}
/** @type {Foo<typeof x, "a">} */
declare const y: Foo<typeof x, "a">;
type Foo<T, K extends keyof T> = T[K];