-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normative: Arbitrary module namespace identifier names #49297
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
@@ -3415,7 +3420,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |||
let suggestion: Symbol | undefined; | |||
let suggestedLib: string | undefined; | |||
// Report missing lib first | |||
if (nameArg) { | |||
if (nameArg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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