Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(checker): use TypeFlagsTypeVariable for consistency with getInfer…
…enceInfoForType

- Change from TypeFlagsTypeParameter to TypeFlagsTypeVariable to match the pattern used in getInferenceInfoForType function
- This ensures consistency in type flag checking across inference-related functions
- TypeFlagsTypeVariable includes both type parameters and indexed access types, which is more comprehensive
- Updated comment to reflect the more accurate terminology 'type variable' instead of 'type parameter'
  • Loading branch information
arash-mosavi committed Sep 20, 2025
commit 5a88d66c6fb1cef7ebb1c34d025e27fad5d55d29
4 changes: 2 additions & 2 deletions internal/checker/inference.go
Original file line number Diff line number Diff line change
Expand Up @@ -1631,9 +1631,9 @@ func (c *Checker) mergeInferences(target []*InferenceInfo, source []*InferenceIn
// 3. For each union member, checking if the indexed property type matches the source literal.
// 4. If a match is found, inferring that union member as a candidate for the type parameter.
func (c *Checker) inferFromLiteralToIndexedAccess(n *InferenceState, source *Type, target *IndexedAccessType) {
// Only proceed if the object type is a type parameter that we're inferring
// Only proceed if the object type is a type variable that we're inferring
objectType := target.objectType
if objectType.flags&TypeFlagsTypeParameter != 0 {
if objectType.flags&TypeFlagsTypeVariable != 0 {
// Get the inference info for the type parameter
inference := getInferenceInfoForType(n, objectType)
if inference == nil || inference.isFixed {
Expand Down