mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 20:19:25 -05:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user