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.
This commit is contained in:
Nathan Shively-Sanders 2017-11-28 15:11:08 -08:00
parent 61fe04ba0d
commit 341e7029eb

View file

@ -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);