Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up[Feature request] sort literals in .d.ts #32224
Comments
This comment has been minimized.
This comment has been minimized.
|
Related: #29255 If you implement this, you'll break my compile-time tests again =( |
This comment has been minimized.
This comment has been minimized.
|
This is labeled |
This comment has been minimized.
This comment has been minimized.
|
@fatcerberus This is just requesting that d.ts emit sorts the union right before printing it. It wouldn't affect the checker itself. @AnyhowStep but then it would be the last time??? |
This comment has been minimized.
This comment has been minimized.
|
Oh, right. I hecked up. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@tp It's almost certainly the same, since that difference is probably from types getting created in different order for |
This comment has been minimized.
This comment has been minimized.
|
If we're sorting string literals, can we also sort all the other literal types? Maybe even unique symbols. I just had another compile-time test break because the order of execution caused some union type to switch elements around. |
This comment has been minimized.
This comment has been minimized.
|
@AnyhowStep good idea |




Search Terms
Suggestion
sort string literal in .d.ts
Use Cases
avoid string literal random change order when source code didn't change
and make code history is more easy read
in this issue thread
string literalis mean =>"a" | "c" | "b"this not only happen on
Record, it has chance happen at all type is auto create by typescript emit withstring literalExamples
current .d.ts output
in this request
Checklist
My suggestion meets these guidelines:
Maintainer's note [@sandersn]: To implementers: When you implement this, be sure to sort other literal types too. Consider sorting other things, like symbol, by the order of their string representation.