-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Rename JS-specific concepts #26795
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
Rename JS-specific concepts #26795
Conversation
1. Assignment declaration -- an assignment that is treated like a declaration. Previously called [JS] special (assignment|declaration), among other things. 2. Expando -- a value that can be used as a target in assignment declarations. Currently, a class, function or empty object literal. Functions are allowed in Typescript, too. Previously called a JS container, JS initializer or expando object. 3. JavaScript -> Javascript. This is annoying to type, and looks like 'Java Script' in a camelCase world. Everything is a pure rename as far as I know. The only test change is the API baselines, which reflect the rename from SymbolFlags.JSContainer to SymbolFlags.Assignment.
@@ -3432,7 +3432,7 @@ namespace ts { | |||
ExportStar = 1 << 23, // Export * declaration | |||
Optional = 1 << 24, // Optional property | |||
Transient = 1 << 25, // Transient symbol (created during type check) | |||
JSContainer = 1 << 26, // Contains Javascript special declarations | |||
Assignment = 1 << 26, // Assignment treated as declaration (eg `this.prop = 1`) |
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.
The comments make it sound like the meaning changed -- previously this would be the symbol for the thing you're assigning to properties of, now it sounds like the symbol for a particular assignment?
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.
Yes, I just merged #26690, which puts this flag on all assignment declarations, not just ones that are themselves containers. I decided to put all the renames in this PR, though.
|
By the way, be sure to make a note in API breaking changes for any public names changed. |
Note that this introduces a variable name collision in a couple of places, which I resolved like this: ```ts const isInJavascript = isInJSFile(node); ```
@sandersn 👍 from me |
I really would prefer we stay consistent about spelling the names with the appropriate capitalization. We already had "TypeScript" and "JavaScript" as names in the compiler. |
@DanielRosenwasser I hope to switch entirely to TS or JS. Any opinions on Ts vs TS? |
Everything is a pure rename as far as I know. The only test change is the API baselines, which reflect the rename from SymbolFlags.JSContainer to SymbolFlags.Assignment.
If you have better ideas for names, please mention them. @RyanCavanaugh and I agree that the best technical term for expando is "Assignment declaration target", but I think this is unwieldy for use in function names.