-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Adds support for type parameter defaults #13487
Merged
Merged
Changes from 6 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3d3dae0
Adds support for type parameter defaults
rbuckton 442f540
Updated Promise and PromiseLike to use defaults
rbuckton 25cb02e
Fix circularity check, simplify default type mapper
rbuckton ca16ba8
Added comments and additional circularity tests
rbuckton 0b44a2c
Flexible declaration merging
rbuckton 0500065
Avoid inference for fully-supplied type arguments
rbuckton 5ff0f81
Diagnostic message punctuation
rbuckton a2be5e2
Report error using type parameter from merged declaration
rbuckton fd228a9
Remove partial inference
rbuckton 6b2c8cb
Defaults for type aliases
rbuckton 76ba6a7
Merge branch 'master' into genericDefaults
rbuckton 15232fe
Remove circular default check
rbuckton f5f1c7e
Merge branch 'genericDefaults' of https://github.com/Microsoft/TypeSc…
rbuckton febde3f
Revert noConstraintType name change
rbuckton b58ef9e
Merge branch 'master' into genericDefaults
rbuckton 7616e37
Use length() throught checker
rbuckton e001258
Move non-local type parameter check to resolveName
rbuckton 9ba2a6b
Skip type parameters.
rbuckton 6091050
Remove pre-computation of minTypeArgumentCount
rbuckton 6ffcbf5
Merge branch 'master' into genericDefaults
rbuckton 5bb2fe0
Simplify checkTypeParameterListsIdentical
rbuckton 96181c0
Shortcut for class/namespace merge
rbuckton 23216f9
Merge branch 'master' into genericDefaults
rbuckton 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ namespace ts { | |
case SyntaxKind.TypeParameter: | ||
return visitNode(cbNode, (<TypeParameterDeclaration>node).name) || | ||
visitNode(cbNode, (<TypeParameterDeclaration>node).constraint) || | ||
visitNode(cbNode, (<TypeParameterDeclaration>node).default) || | ||
visitNode(cbNode, (<TypeParameterDeclaration>node).expression); | ||
case SyntaxKind.ShorthandPropertyAssignment: | ||
return visitNodes(cbNodes, node.decorators) || | ||
|
@@ -2098,6 +2099,10 @@ namespace ts { | |
} | ||
} | ||
|
||
if (parseOptional(SyntaxKind.EqualsToken)) { | ||
node.default = parseType(); | ||
} | ||
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. Nit: I would really like for if the parsing was order-agnostic for the purpose of error reporting, and then gave a grammar error later on. This could be done as a separate pass. |
||
|
||
return finishNode(node); | ||
} | ||
|
||
|
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
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
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.
Missing trailing period in this and in line 2046