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

This commit is contained in:
Oleksandr T 2024-05-11 00:46:51 +03:00 коммит произвёл GitHub
Родитель 72c12c9920
Коммит 017c1e0e64
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -397,7 +397,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);
if (importAdder) {
if (typeParameters) {
const newTypeParameters = sameMap(typeParameters, typeParameterDecl => {

Просмотреть файл

@ -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.");
}
}`,
});