mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Fix crash on aliased,exported @enum tag in jsdoc (#36996)
THe code to bind `@enum` and `@typedef` didn't handle the case that the
`@enum` was on a property assignment to an alias of module.exports.
Specifically, `x` needs to be correctly aliased to the file's symbol in
the example below:
```
var x = module.exports = {};
/** @enum {string} */
x.E = {
A: "A"
};
```
This commit is contained in:
committed by
GitHub
parent
65e7acce58
commit
3e3df8702c
@@ -2113,7 +2113,9 @@ namespace ts {
|
||||
container = (declName.parent.expression as PropertyAccessExpression).name;
|
||||
break;
|
||||
case AssignmentDeclarationKind.Property:
|
||||
container = isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
container = isExportsOrModuleExportsOrAlias(file, declName.parent.expression) ? file
|
||||
: isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name
|
||||
: declName.parent.expression;
|
||||
break;
|
||||
case AssignmentDeclarationKind.None:
|
||||
return Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
|
||||
Reference in New Issue
Block a user