Repository navigation
Conversation
Substituted type arguments were evaluated with the alias-expansion set of the reference site instead of where the argument was written, so finite nested instantiations such as Maybe<Maybe<unknown>> were treated as recursion and missed by no-unknown-type-aliases, no-unknown-returns, and no-object-parameters.
This was referenced Oct 24, 2026
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.
Problem
Alias resolution treats finite nested instantiations of the same generic alias as recursion, so
unknownandobjecthidden behind them go unreported:Type arguments were evaluated with the alias-expansion set active at the point where the parameter was used, not where the argument was written. When the outer
Maybebody reachesT, the innerMaybe<unknown>argument was resolved withMaybealready marked as expanding, so resolution stopped.Fix
Each substitution now stores the alias-expansion set from where its argument was written: the reference site for explicit arguments, and inside the alias for defaults. Evaluation picks up from that set. Genuinely recursive aliases still terminate, because an alias referenced inside its own body is still being expanded at that point.
Tests
New
no-unknown-type-aliasesRuleTester cases:Maybe<Maybe<unknown>>,Identity<Identity<Identity<unknown>>>,Pair<string, Pair<number, unknown>>. The first fails before this change.Loop<T> = Loop<T>,Nested<T> = T | Nested<Nested<T>>,Tree<T>with recursive children,Maybe<Maybe<string>>.pnpm checkpasses, and the skill assets are re-synced.