Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(55765): Implement Interface Code Action is not available under certain circumstances #55767

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/services/codefixes/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export function createSignatureDeclarationFromSignature(

let typeParameters = isJs ? undefined : signatureDeclaration.typeParameters;
let parameters = signatureDeclaration.parameters;
let type = isJs ? undefined : signatureDeclaration.type;
let type = isJs ? undefined : getSynthesizedDeepClone(signatureDeclaration.type);
a-tarasyuk marked this conversation as resolved.
Show resolved Hide resolved
if (importAdder) {
if (typeParameters) {
const newTypeParameters = sameMap(typeParameters, typeParameterDecl => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/// <reference path='fourslash.ts' />

////type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
////
////export type DeepPartial<T> = T extends Builtin ? T :
//// T extends Array<infer U> ? Array<DeepPartial<U>> :
//// T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> :
//// T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> } : Partial<T>;
////
////export interface Nested {
//// field: string;
////}
////
////interface Foo {
//// request(): DeepPartial<{ nested1: Nested; test2: Nested }>;
////}
////[|export class C implements Foo {}|]

verify.codeFix({
description: "Implement interface 'Foo'",
newRangeContent:
`export class C implements Foo {
request(): { nested1?: { field?: string; }; test2?: { field?: string; }; } {
throw new Error("Method not implemented.");
}
}`,
});