Repository navigation
PoC for #36165 'inherit' keyword - #64811
Draft
Tadhg McDonald-Jensen (tadhgmister) wants to merge 2 commits into
Draft
Tadhg McDonald-Jensen (tadhgmister) wants to merge 2 commits into
Tadhg McDonald-Jensen (tadhgmister) wants to merge 2 commits into
Conversation
Author
|
@microsoft-github-policy-service agree |
Adds the example inherit type alias with generics into the es5.d.ts lib and adds some logic to getTypeFromTypeAliasReference in checker.go that auto fills the generics when omitted to the 'inherit' type alias. Also has updated tests to see the correct behaviour of the intended feature. AI usage disclosure: - the go code was mostly written by AI and should not be considered production quality. - the test code was composed by AI from many examples I wrote to test the feature.
Tadhg McDonald-Jensen (tadhgmister)
force-pushed
the
inherit-PoC
branch
from
October 14, 2026 04:01
621bbe5 to
de8e911
Compare
5 tasks done
Now properly identifies getters and setters instead of trying to treat the return/first arg of the field which if the field is not a function type would go to 'never' Also removed the explicit generic case from the test suite, isn't really something we necessarily want to support
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds the example inherit type alias with generics into the es5.d.ts lib and adds some logic to getTypeFromTypeAliasReference in checker.go that auto fills the generics when omitted to the 'inherit' type alias.
This PoC has several limitations with the way it was implemented:
foo(a:1, b:2, c:3, d:4, e:5, ...rest: inherit)fails saying a string literal error message does not extend an array type.inheritis defined, it can get generic arguments specified for it even though it doesn't actually correspond to the expected type (this is because it is only matched by symbol name)inheritis used somewhere it is not expected to be used it gives the error message that it expects 2-4 type arguments instead of saying "it isn't legal to use it there" which would be far more helpful.neverinstead.Several correct and expected behaviours are recorded into a test case which passes with this implementation.
AI usage disclosure:
Fixes #36165