Avoid trying to emit anonymous classish/expando functions as assignments#55472
Avoid trying to emit anonymous classish/expando functions as assignments#55472weswigham merged 3 commits intomicrosoft:mainfrom
Conversation
src/compiler/checker.ts
Outdated
| if (!context.remappedSymbolRefernces) { | ||
| context.remappedSymbolRefernces = new Map(); | ||
| } | ||
| context.remappedSymbolRefernces.set(getSymbolId(type.symbol), symbol); // save name remapping as local name for target symbol |
There was a problem hiding this comment.
This is to handle the not-anonymous-but-still-an-expression case where you could use that local name to refer to the type of the expando-thing as a whole. Because it'd be odd if just adding a name to the function expression made this transform stop working.
There was a problem hiding this comment.
Is this is for cases like
const f = function g() { }
f.p = 1Does remappedSymbolReferences record g? When would g show up in the declaration emit?
Edit: Looking at the test cases, it's actually g -> f so that when a constructor function g returns g, it serialises as f.
src/compiler/checker.ts
Outdated
| if (!context.remappedSymbolRefernces) { | ||
| context.remappedSymbolRefernces = new Map(); | ||
| } | ||
| context.remappedSymbolRefernces.set(getSymbolId(type.symbol), symbol); // save name remapping as local name for target symbol |
There was a problem hiding this comment.
Is this is for cases like
const f = function g() { }
f.p = 1Does remappedSymbolReferences record g? When would g show up in the declaration emit?
Edit: Looking at the test cases, it's actually g -> f so that when a constructor function g returns g, it serialises as f.
Fixes #55172