From 341e7029eb6d272d9eb910eb0a824a1296a64364 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 28 Nov 2017 15:11:08 -0800 Subject: [PATCH] JS static prop assignments don't need same type Don't issue a "multiple declarations must have the same type" error for JS static property assignments, because these don't appear to have a type in this case. --- src/compiler/checker.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bb1e26ede8..bf6d0c20f6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21462,6 +21462,10 @@ namespace ts { } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, nextType: Type): void { + if (isIdentifier(firstDeclaration) || isIdentifier(nextDeclaration)) { + // js static assignment declarations don't have a type, so don't have to be consistent + return; + } const firstSourceFile = getSourceFileOfNode(firstDeclaration); const firstSpan = getErrorSpanForNode(firstSourceFile, getNameOfDeclaration(firstDeclaration) || firstDeclaration); const firstLocation = getLineAndCharacterOfPosition(firstSourceFile, firstSpan.start);