-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat(transformer): Support circular interface extensions #389
Open
martinjlowm
wants to merge
15
commits into
Typescript-TDD:master
Choose a base branch
from
martinjlowm:feature/recursive-generics
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
da1750c
feat(transformer): Support circular interface extensions
martinjlowm c35347b
chore(docs): Remove circular generics from types-not-supported.mdx
martinjlowm 3f0bd8c
fix(transformer): Store reference to parent generic to avoid a reboun…
martinjlowm 086b1da
fix(transformer): Keep a bound-state regardless of declaration keys, …
martinjlowm aa5285f
chore(test): Bump the nesting of the generic recursion test for good …
martinjlowm 0b80962
chore(test): Extend the circular generic test with cross references b…
martinjlowm b1cab69
Merge branch 'master' into feature/recursive-generics
uittorio 079c3f0
Merge branch 'master' into feature/recursive-generics
martinjlowm 84762b8
fix(transformer): Adjust the Scope bind interface to make it work for…
martinjlowm 454713f
fix(transformer): Properly distinguish scoped references in a generic…
martinjlowm b8fa5ce
fix(transformer): Remove constructor marker
martinjlowm e000ef9
Merge branch 'master' into feature/recursive-generics
martinjlowm b66779a
chore(transformer): Use MockPrivatePrefix for generic owner references
martinjlowm a9b5013
fix(transformer): Correct scope nesting and owner reference through a…
martinjlowm 8d6341f
Merge branch 'master' into feature/recursive-generics
martinjlowm 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
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
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
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.
It may be a dumb question but I still don't understand why the previous
if statement
is not good enough to make sure is a circular generic dependency?I mean this
const isExtendingItself: boolean = MockDefiner.instance.getDeclarationKeyMap(typeParameterDeclaration) === declarationKey;
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 old condition was fine if you were to completely ignore circular generics and terminate early.
However, this time around, we want to process the declaration exactly twice, where the second iteration avoids calling
GetDescriptor
(which is what's causing the infinite recursion) and instead utilizesthis.constructor
for a back-reference.isExtendingItself
does not help us in that case if we were to use it to our advantage, since the type checker would bring us to the same declaration on everyGetDescriptor
call and result in the same scenario, yes, it is extending itself, over and over.