Skip to content

Commit 017c1e0

Browse files
authored
fix(55765): Implement Interface Code Action is not available under certain circumstances (#55767)
1 parent 72c12c9 commit 017c1e0

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/services/codefixes/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ export function createSignatureDeclarationFromSignature(
397397

398398
let typeParameters = isJs ? undefined : signatureDeclaration.typeParameters;
399399
let parameters = signatureDeclaration.parameters;
400-
let type = isJs ? undefined : signatureDeclaration.type;
400+
let type = isJs ? undefined : getSynthesizedDeepClone(signatureDeclaration.type);
401401
if (importAdder) {
402402
if (typeParameters) {
403403
const newTypeParameters = sameMap(typeParameters, typeParameterDecl => {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
4+
////
5+
////export type DeepPartial<T> = T extends Builtin ? T :
6+
//// T extends Array<infer U> ? Array<DeepPartial<U>> :
7+
//// T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> :
8+
//// T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } : Partial<T>;
9+
////
10+
////export interface Nested {
11+
//// field: string;
12+
////}
13+
////
14+
////interface Foo {
15+
//// request(): DeepPartial<{ nested1: Nested; test2: Nested }>;
16+
////}
17+
////[|export class C implements Foo {}|]
18+
19+
verify.codeFix({
20+
description: "Implement interface 'Foo'",
21+
newRangeContent:
22+
`export class C implements Foo {
23+
request(): { nested1?: { field?: string; }; test2?: { field?: string; }; } {
24+
throw new Error("Method not implemented.");
25+
}
26+
}`,
27+
});

0 commit comments

Comments
 (0)