diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 82ab87d316..3f5d2cf68f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4683,7 +4683,8 @@ namespace ts { else if (isJSDocPropertyTag(declaration) || isPropertyAccessExpression(declaration) || isIdentifier(declaration) - || isMethodDeclaration(declaration) && !isObjectLiteralMethod(declaration)) { + || (isMethodDeclaration(declaration) && !isObjectLiteralMethod(declaration)) + || isMethodSignature(declaration)) { // TODO: Mimics old behavior from incorrect usage of getWidenedTypeForVariableLikeDeclaration, but seems incorrect type = tryGetTypeFromEffectiveTypeNode(declaration) || anyType; } diff --git a/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.js b/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.js new file mode 100644 index 0000000000..f4f46b92c3 --- /dev/null +++ b/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.js @@ -0,0 +1,12 @@ +//// [methodSignatureHandledDeclarationKindForSymbol.ts] +interface Foo { + bold(): string; +} + +interface Foo { + bold: string; +} + + + +//// [methodSignatureHandledDeclarationKindForSymbol.js] diff --git a/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.symbols b/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.symbols new file mode 100644 index 0000000000..27bc633ce5 --- /dev/null +++ b/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.symbols @@ -0,0 +1,16 @@ +=== tests/cases/compiler/methodSignatureHandledDeclarationKindForSymbol.ts === +interface Foo { +>Foo : Symbol(Foo, Decl(methodSignatureHandledDeclarationKindForSymbol.ts, 0, 0), Decl(methodSignatureHandledDeclarationKindForSymbol.ts, 2, 1)) + + bold(): string; +>bold : Symbol(Foo.bold, Decl(methodSignatureHandledDeclarationKindForSymbol.ts, 0, 15), Decl(methodSignatureHandledDeclarationKindForSymbol.ts, 4, 15)) +} + +interface Foo { +>Foo : Symbol(Foo, Decl(methodSignatureHandledDeclarationKindForSymbol.ts, 0, 0), Decl(methodSignatureHandledDeclarationKindForSymbol.ts, 2, 1)) + + bold: string; +>bold : Symbol(Foo.bold, Decl(methodSignatureHandledDeclarationKindForSymbol.ts, 0, 15), Decl(methodSignatureHandledDeclarationKindForSymbol.ts, 4, 15)) +} + + diff --git a/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.types b/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.types new file mode 100644 index 0000000000..6f01b381f4 --- /dev/null +++ b/tests/baselines/reference/methodSignatureHandledDeclarationKindForSymbol.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/methodSignatureHandledDeclarationKindForSymbol.ts === +interface Foo { +>Foo : Foo + + bold(): string; +>bold : string +} + +interface Foo { +>Foo : Foo + + bold: string; +>bold : string +} + + diff --git a/tests/cases/compiler/methodSignatureHandledDeclarationKindForSymbol.ts b/tests/cases/compiler/methodSignatureHandledDeclarationKindForSymbol.ts new file mode 100644 index 0000000000..f92927da4e --- /dev/null +++ b/tests/cases/compiler/methodSignatureHandledDeclarationKindForSymbol.ts @@ -0,0 +1,8 @@ +interface Foo { + bold(): string; +} + +interface Foo { + bold: string; +} +