JSDoc typedefs don't actually have hosts, because they're not semantically attached to a declaration. However, the parser still attaches them to some declaration (or statement), but that declaration is not related to the typedef. Previously, delayedBindJSDocTypedefTag used getJSDocHost to walk past the unrelated declaration, but #41858 correctly started categorising typedefs as unattached, with no host, so the binder began falling back to file scope. The path to skip the unrelated declaration is always the same, though, so this PR uses `typeAlias.parent.parent` instead of `getJSDocHost(typeAlias)`.
21 lines
509 B
Plaintext
21 lines
509 B
Plaintext
tests/cases/conformance/jsdoc/typedefScope1.js(13,12): error TS2304: Cannot find name 'B'.
|
|
|
|
|
|
==== tests/cases/conformance/jsdoc/typedefScope1.js (1 errors) ====
|
|
function B1() {
|
|
/** @typedef {number} B */
|
|
/** @type {B} */
|
|
var ok1 = 0;
|
|
}
|
|
|
|
function B2() {
|
|
/** @typedef {string} B */
|
|
/** @type {B} */
|
|
var ok2 = 'hi';
|
|
}
|
|
|
|
/** @type {B} */
|
|
~
|
|
!!! error TS2304: Cannot find name 'B'.
|
|
var notOK = 0;
|
|
|