Normative: Arbitrary module namespace identifier names#49297
Normative: Arbitrary module namespace identifier names#49297Jack-Works wants to merge 6 commits intomicrosoft:mainfrom
Conversation
27c4aae to
026fba8
Compare
|
Made a full rewrite of this PR. Just get the compiler part to work. Will handle language service days later. |
src/compiler/checker.ts
Outdated
| let suggestedLib: string | undefined; | ||
| // Report missing lib first | ||
| if (nameArg) { | ||
| if (nameArg) { |
There was a problem hiding this comment.
Nit: extraneous whitespace:
| if (nameArg) { | |
| if (nameArg) { |
ab0073c to
89b405b
Compare
|
Hi, @DanielRosenwasser I have a question. With this PR, it's possible to define members with names that cannot be an identifier on a Symbol. export const enum InternalSymbolName {
Call = "__call", // Call signatures
Constructor = "__constructor", // Constructor implementations
New = "__new", // Constructor signatures
Index = "__index", // Index signatures
ExportStar = "__export", // Module export * declarations
Global = "__global", // Global self-reference
Missing = "__missing", // Indicates missing symbol
Type = "__type", // Anonymous type literal symbol
Object = "__object", // Anonymous object literal declaration
JSXAttributes = "__jsxAttributes", // Anonymous JSX attributes object literal declaration
Class = "__class", // Unnamed class expression
Function = "__function", // Unnamed function expression
Computed = "__computed", // Computed property name declaration with dynamic name
Resolving = "__resolving__", // Indicator symbol used to mark partially resolved type aliases
ExportEquals = "export=", // Export assignment symbol
Default = "default", // Default export symbol (technically not wholly internal, but included here for usability)
This = "this",
}I wonder if this PR gonna make programmers able to write code that breaks TS by declaring a symbol member that has the same name as an internal symbol, like export { item as "this" }
// or
export { item as "export=", item as __new } |
|
I think the comment
is the key here, and the same applies to Maybe @weswigham or @gabritto can back me up on that statement though. |
Implementing tc39/ecma262#2154