Skip to content

Commit dbc501f

Browse files
committed
Move fix around
1 parent c6295f4 commit dbc501f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

internal/checker/checker.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21188,9 +21188,6 @@ func (c *Checker) getDefaultTypeArgumentType(isInJavaScriptFile bool) *Type {
2118821188
// this gets the instantiated default type of its target. If the type parameter has no default type or
2118921189
// the default is circular, `undefined` is returned.
2119021190
func (c *Checker) getDefaultFromTypeParameter(t *Type) *Type {
21191-
if t.flags&TypeFlagsTypeParameter == 0 {
21192-
return nil
21193-
}
2119421191
defaultType := c.getResolvedTypeParameterDefault(t)
2119521192
if defaultType != c.noConstraintType && defaultType != c.circularConstraintType {
2119621193
return defaultType

internal/checker/inference.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,11 +1292,14 @@ func (c *Checker) getInferredType(n *InferenceContext, index int) *Type {
12921292
// succeeds, meaning there is no error for not having inference candidates. An
12931293
// inference error only occurs when there are *conflicting* candidates, i.e.
12941294
// candidates with no common supertype.
1295-
defaultType := c.getDefaultFromTypeParameter(inference.typeParameter)
1296-
if defaultType != nil {
1297-
// Instantiate the default type. Any forward reference to a type
1298-
// parameter should be instantiated to the empty object type.
1299-
inferredType = c.instantiateType(defaultType, mergeTypeMappers(c.newBackreferenceMapper(n, index), n.nonFixingMapper))
1295+
1296+
if inference.typeParameter.flags&TypeFlagsTypeParameter != 0 {
1297+
defaultType := c.getDefaultFromTypeParameter(inference.typeParameter)
1298+
if defaultType != nil {
1299+
// Instantiate the default type. Any forward reference to a type
1300+
// parameter should be instantiated to the empty object type.
1301+
inferredType = c.instantiateType(defaultType, mergeTypeMappers(c.newBackreferenceMapper(n, index), n.nonFixingMapper))
1302+
}
13001303
}
13011304
}
13021305
} else {

0 commit comments

Comments
 (0)