From 2fdb5b8659bbf909a90f11d1e31b43bbe0da934c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 11 Sep 2017 11:16:01 -0700 Subject: [PATCH] assignContextualParameterTypes handles arguments object Previously, it would crash — the arguments object is a transient symbol with no declaration, and `getEffectiveTypeAnnotationNode` does not accept `undefined`. --- src/compiler/checker.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ff5d1c661e8..b8b2e8edb82 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -16665,8 +16665,9 @@ namespace ts { } } if (signature.hasRestParameter && isRestParameterIndex(context, signature.parameters.length - 1)) { + // parameter might be a transient symbol generated by use of `arguments` in the function body. const parameter = lastOrUndefined(signature.parameters); - if (!getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) { + if (isTransientSymbol(parameter) || !getEffectiveTypeAnnotationNode(parameter.valueDeclaration)) { const contextualParameterType = getTypeOfSymbol(lastOrUndefined(context.parameters)); assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType); }