- Notifications
You must be signed in to change notification settings - Fork13.2k
Normative: Arbitrary module namespace identifier names#49297
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Jack-Works commentedApr 23, 2023
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.
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 to89b405bCompareUh oh!
There was an error while loading.Please reload this page.
Jack-Works commentedJun 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. exportconstenumInternalSymbolName{Call="__call",// Call signaturesConstructor="__constructor",// Constructor implementationsNew="__new",// Constructor signaturesIndex="__index",// Index signaturesExportStar="__export",// Module export * declarationsGlobal="__global",// Global self-referenceMissing="__missing",// Indicates missing symbolType="__type",// Anonymous type literal symbolObject="__object",// Anonymous object literal declarationJSXAttributes="__jsxAttributes",// Anonymous JSX attributes object literal declarationClass="__class",// Unnamed class expressionFunction="__function",// Unnamed function expressionComputed="__computed",// Computed property name declaration with dynamic nameResolving="__resolving__",// Indicator symbol used to mark partially resolved type aliasesExportEquals="export=",// Export assignment symbolDefault="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{itemas"this"}// orexport{itemas"export=",itemas__new} |
DanielRosenwasser commentedJun 14, 2023
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. |
Uh oh!
There was an error while loading.Please reload this page.
Implementingtc39/ecma262#2154