mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 01:39:28 -06:00
fix(49392): show optional class methods with enabled strict option (#49768)
This commit is contained in:
parent
efbe03a33c
commit
91f7cfc501
@ -138,7 +138,7 @@ namespace ts.codefix {
|
||||
// If there is more than one overload but no implementation signature
|
||||
// (eg: an abstract method or interface declaration), there is a 1-1
|
||||
// correspondence of declarations and signatures.
|
||||
const signatures = checker.getSignaturesOfType(type, SignatureKind.Call);
|
||||
const signatures = type.isUnion() ? flatMap(type.types, t => t.getCallSignatures()) : type.getCallSignatures();
|
||||
if (!some(signatures)) {
|
||||
break;
|
||||
}
|
||||
|
||||
29
tests/cases/fourslash/completionsOverridingMethod14.ts
Normal file
29
tests/cases/fourslash/completionsOverridingMethod14.ts
Normal file
@ -0,0 +1,29 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: a.ts
|
||||
// @strictNullChecks: true
|
||||
// @newline: LF
|
||||
|
||||
////interface IFoo {
|
||||
//// foo?(arg: string): number;
|
||||
////}
|
||||
////class Foo implements IFoo {
|
||||
//// /**/
|
||||
////}
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
isNewIdentifierLocation: true,
|
||||
preferences: {
|
||||
includeCompletionsWithInsertText: true,
|
||||
includeCompletionsWithSnippetText: false,
|
||||
includeCompletionsWithClassMemberSnippets: true,
|
||||
},
|
||||
includes: [
|
||||
{
|
||||
name: "foo",
|
||||
sortText: completion.SortText.ClassMemberSnippets,
|
||||
insertText: "foo(arg: string): number {\n}"
|
||||
},
|
||||
],
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user