54 lines
1.4 KiB
Go
54 lines
1.4 KiB
Go
// Code generated by convertFourslash; DO NOT EDIT.
|
|
// To modify this test, run "npm run makemanual codeFixClassImplementInterfaceAutoImports"
|
|
|
|
package fourslash_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/microsoft/typescript-go/internal/fourslash"
|
|
"github.com/microsoft/typescript-go/internal/testutil"
|
|
)
|
|
|
|
func TestCodeFixClassImplementInterfaceAutoImports(t *testing.T) {
|
|
fourslash.SkipIfFailing(t)
|
|
t.Parallel()
|
|
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
|
|
const content = `// @Filename: types1.ts
|
|
type A = {};
|
|
export default A;
|
|
// @Filename: types2.ts
|
|
export type B = {};
|
|
export type C = {};
|
|
export type D<T> = {};
|
|
// @Filename: interface.ts
|
|
import A from './types1';
|
|
import { B, C, D } from './types2';
|
|
|
|
export interface Base {
|
|
a: Readonly<A> & { kind: "a"; };
|
|
b<T extends B = B>(p1: C): D<C>;
|
|
}
|
|
// @Filename: index.ts
|
|
import { Base } from './interface';
|
|
|
|
export class C implements Base {[| |]}`
|
|
f, done := fourslash.NewFourslash(t, nil /*capabilities*/, content)
|
|
defer done()
|
|
f.GoToFile(t, "index.ts")
|
|
f.VerifyCodeFix(t, fourslash.VerifyCodeFixOptions{
|
|
Description: "Implement interface 'Base'",
|
|
NewFileContent: `import { Base } from './interface';
|
|
import A from './types1';
|
|
import { B, C, D } from './types2';
|
|
|
|
export class C implements Base {
|
|
a: Readonly<A> & { kind: 'a'; };
|
|
b<T extends B = B>(p1: C): D<C> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
}`,
|
|
Index: 0,
|
|
})
|
|
}
|