Skip to content

Commit c5d3969

Browse files
committed
fix the other crash
1 parent 10842d4 commit c5d3969

File tree

4 files changed

+195
-135
lines changed

4 files changed

+195
-135
lines changed

src/compiler/checker.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27419,7 +27419,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2741927419
const impliedArity = constraint.target.fixedLength;
2742027420
if (startLength + impliedArity <= source.target.fixedLength) {
2742127421
inferFromTypes(sliceTupleType(source, startLength, sourceArity - (startLength + impliedArity)), elementTypes[startLength]);
27422-
inferFromTypes(getElementTypeOfSliceOfTupleType(source, startLength + impliedArity, endLength)!, elementTypes[startLength + 1]);
27422+
const restType = getElementTypeOfSliceOfTupleType(source, startLength + impliedArity, endLength);
27423+
if (restType) {
27424+
inferFromTypes(restType, elementTypes[startLength + 1]);
27425+
}
2742327426
}
2742427427
}
2742527428
}
@@ -27435,7 +27438,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2743527438
const startIndex = endIndex - impliedArity;
2743627439
const trailingSlice = createTupleType(getTypeArguments(source).slice(startIndex, endIndex), source.target.elementFlags.slice(startIndex, endIndex), /*readonly*/ false, source.target.labeledElementDeclarations && source.target.labeledElementDeclarations.slice(startIndex, endIndex));
2743727440

27438-
inferFromTypes(getElementTypeOfSliceOfTupleType(source, startLength, endLength + impliedArity)!, elementTypes[startLength]);
27441+
const restType = getElementTypeOfSliceOfTupleType(source, startLength, endLength + impliedArity);
27442+
if (restType) {
27443+
inferFromTypes(restType, elementTypes[startLength]);
27444+
}
2743927445
inferFromTypes(trailingSlice, elementTypes[startLength + 1]);
2744027446
}
2744127447
}

0 commit comments

Comments
 (0)