ca840ee683
The ad-hoc name resolution rule for `exports` forgets to check the requested meaning. When `getTypeReferenceType` calls` resolveTypeReferenceName` with `Type` only in order to give an error when the program uses a value like a type, it is incorrectly able to resolve `exports` instead of producing an error. Then this incorrect symbol gets treated like an alias, which it isn't, causing the assert. The fix, for now, is to make resolution of `exports` check the requested meaning so that it only resolves when `Value` is requested. This makes the above code an error ("Cannot use the namespace 'exports' as a type."), but I think this is fine for a bug fix. We can decide later if `exports` should behave like other expandos and be a legal type reference. Note that the name actually does resolve correctly, so JS users will get the desired completions. They'll just have an error to suppress if they have checkJs on.
10 lines
133 B
TypeScript
10 lines
133 B
TypeScript
// @allowJs: true
|
|
// @noEmit: true
|
|
// @checkJs: true
|
|
// @Filename: bug27342.js
|
|
module.exports = {}
|
|
/**
|
|
* @type {exports}
|
|
*/
|
|
var x
|
|
|