Skip to content

Commit 2fdb5b8

Browse files
committed
assignContextualParameterTypes handles arguments object
Previously, it would crash — the arguments object is a transient symbol with no declaration, and `getEffectiveTypeAnnotationNode` does not accept `undefined`.
1 parent eb80799 commit 2fdb5b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16665,8 +16665,9 @@ namespace ts {
1666516665
}
1666616666
}
1666716667
if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) {
16668+
// parameter might be a transient symbol generated by use of `arguments` in the function body.
1666816669
const parameter = lastOrUndefined(signature.parameters);
16669-
if (!getEffectiveTypeAnnotationNode(<ParameterDeclaration>parameter.valueDeclaration)) {
16670+
if (isTransientSymbol(parameter) || !getEffectiveTypeAnnotationNode(<ParameterDeclaration>parameter.valueDeclaration)) {
1667016671
const contextualParameterType = getTypeOfSymbol(lastOrUndefined(context.parameters));
1667116672
assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType);
1667216673
}

0 commit comments

Comments
 (0)