We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#50528
Background: two types of enums
number
What makes an enum numeric?
FlagA | FlagB
What if we just tried to make everything a literal enum?
enum E { A = 1, // E.A = [E#1] (TypeFlags.NumericLiteral | TypeFlags.EnumLiteral) B = 1, // E.B = [E#1] (TypeFlags.NumericLiteral | TypeFlags.EnumLiteral) C = 1, // E.C = [E#2] (TypeFlags.NumericLiteral | TypeFlags.EnumLiteral) D = "foo", // E.D = [E@"foo"] (TypeFlags.StringLiteral | TypeFlags.EnumLiteral) E = B + C, // E.E = [E#3] (TypeFlags.NumericLiteral | TypeFlags.EnumLiteral) F = someFunc(1), // E.F = unique E (TypeFlags.Enum) G = someFunc(1), // E.G = unique E (TypeFlags.Enum) }
Bitflags? How do you assign back?
What about narrowing on unique values? *
What gets broken in the compiler?
FlowType
0
flowType.flags === 0
flowType.flags = 0
CheckMode
Maybe there's room here for something like leveraging "freshness" the same way we do for object literal freshness in excess property checking.
Declaration file says that E.F and E.G have no initializer - not auto-numbered, just computed.
E.F
E.G
Seems like we're using flags quite a bit - if we're not broken terribly, that's a good indication that we can roll out the change.
The breakage isn't so much the concern - it's more the type-checking speed.
The fact that declaration emit has silently converted numeric enums to literal enums and nobody has run into issues is pretty telling.
Maybe there should not be a distinction around numbers vs strings - we can always have arbitrary unique objects as values.
What's the emit? One-way bindings from name to value? Or do we do the reverse mapping?
someFunc
string
#50133
.css
.wasm
.d.ts
filename.d.ext.ts
filename.ext
styles.css
styles.d.css.ts
"allowNonJsImports": true
"allownonJsImports": ["css", "html"]
.d.ext.ts
.json
resolveJsonModules
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Enums
#50528
Background: two types of enums
number
What makes an enum numeric?
FlagA | FlagB
)What if we just tried to make everything a literal enum?
number
.Bitflags? How do you assign back?
What about narrowing on unique values?
*
What gets broken in the compiler?
FlowType
against0
.flowType.flags === 0
fails, butflowType.flags = 0
works?CheckMode
being truthy and then not-assignable to0
Maybe there's room here for something like leveraging "freshness" the same way we do for object literal freshness in excess property checking.
Declaration file says that
E.F
andE.G
have no initializer - not auto-numbered, just computed.Seems like we're using flags quite a bit - if we're not broken terribly, that's a good indication that we can roll out the change.
The breakage isn't so much the concern - it's more the type-checking speed.
The fact that declaration emit has silently converted numeric enums to literal enums and nobody has run into issues is pretty telling.
Maybe there should not be a distinction around numbers vs strings - we can always have arbitrary unique objects as values.
What's the emit? One-way bindings from name to value? Or do we do the reverse mapping?
someFunc
returned astring
?Declaration Files for Non-JS Files
#50133
.css
,.wasm
, etc. files..d.ts
.filename.d.ext.ts
would imply the existence of afilename.ext
styles.css
would need a declaration file calledstyles.d.css.ts
"allowNonJsImports": true
"allownonJsImports": ["css", "html"]
.d.ext.ts
files unless they're there and imported in the first place..json
file?resolveJsonModules
)resolveJsonModules
.json
imports?The text was updated successfully, but these errors were encountered: