-
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
Template literal types and mapped type 'as' clauses #40336
Merged
Merged
Changes from 31 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
1a6676e
Initial implementation of string template types
ahejlsberg 27d9164
Accept new API baselines
ahejlsberg 0b9c5f5
Accept new baselines
ahejlsberg 815a408
Unified checking for large cross product union types
ahejlsberg 032e1bf
Accept new baselines
ahejlsberg ced200f
Ensure errors from union type resolution are reported
ahejlsberg d2ad4c1
Accept new baselines
ahejlsberg b5b897d
Compute constraints for string template types
ahejlsberg 3b14f3d
Support `as T` clause in mapped types
ahejlsberg 6a8e070
Accept new API baselines
ahejlsberg a63a442
Add missing semicolon
ahejlsberg 45ea576
Add checking of `as T` clauses
ahejlsberg 05e2ef1
Support casing modifiers in string template types
ahejlsberg 95ac3d4
Accept new baselines
ahejlsberg c95c000
Bump keyword maximum length
ahejlsberg b3178d4
fix anders
egamma 8cac241
Revert "fix anders"
egamma 4061ba9
Properly handle 'as T' clause with keyof for mapped type
ahejlsberg d68670b
Fix lint error
ahejlsberg b7b58c7
Single character inferences and anchored end span matching
ahejlsberg b12681d
Fewer array copy operations in template literal type resolution
ahejlsberg 272b23f
Handle cases where 'as T' maps multiple properties onto one
ahejlsberg 3b6e8c2
Fix lint error
ahejlsberg 6dc0b2a
Store key type instead of type mapper in MappedSymbol
ahejlsberg 9c1f9fb
No constraint on `in T` type when `as N` clause present
ahejlsberg b2518c6
Rename from TemplateType to TemplateLiteralType
ahejlsberg 2d70ca2
Accept new API baselines
ahejlsberg 096d0ae
Add tests
ahejlsberg 1488f35
Accept new baselines
ahejlsberg 66337ed
Merge branch 'master' of https://github.com/microsoft/TypeScript
ahejlsberg b5e75dd
Merge branch 'master' into templateTypes
ahejlsberg 6c95951
Address CR feedback
ahejlsberg e81ebb4
Accept new API baselines
ahejlsberg 6bd94b0
Merge branch 'master' of https://github.com/microsoft/TypeScript
ahejlsberg d38a388
Merge branch 'master' into templateTypes
ahejlsberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,10 @@ namespace ts { | |
yield: SyntaxKind.YieldKeyword, | ||
async: SyntaxKind.AsyncKeyword, | ||
await: SyntaxKind.AwaitKeyword, | ||
uppercase: SyntaxKind.UppercaseKeyword, | ||
lowercase: SyntaxKind.LowercaseKeyword, | ||
capitalize: SyntaxKind.CapitalizeKeyword, | ||
uncapitalize: SyntaxKind.UncapitalizeKeyword, | ||
of: SyntaxKind.OfKeyword, | ||
}; | ||
|
||
|
@@ -1508,9 +1512,9 @@ namespace ts { | |
} | ||
|
||
function getIdentifierToken(): SyntaxKind.Identifier | KeywordSyntaxKind { | ||
// Reserved words are between 2 and 11 characters long and start with a lowercase letter | ||
// Reserved words are between 2 and 12 characters long and start with a lowercase letter | ||
const len = tokenValue.length; | ||
if (len >= 2 && len <= 11) { | ||
if (len >= 2 && len <= 12) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this change should be reverted since #40580 has removed |
||
const ch = tokenValue.charCodeAt(0); | ||
if (ch >= CharacterCodes.a && ch <= CharacterCodes.z) { | ||
const keyword = textToKeyword.get(tokenValue); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.