package fourslash_test import ( "testing" "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash" . "efprojects.com/kitten-ipc/kitcom/internal/tsgo/fourslash/tests/util" "efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil" ) func TestCompletionsLiteralOverload(t *testing.T) { t.Parallel() defer testutil.RecoverAndFail(t, "Panic on fourslash test") const content = `// @allowJs: true // @Filename: /a.tsx interface Events { "": any; drag: any; dragenter: any; } declare function addListener(type: K, listener: (ev: Events[K]) => any): void; declare function ListenerComponent(props: { type: K, onWhatever: (ev: Events[K]) => void }): JSX.Element; addListener("/*ts*/"); (); // @Filename: /b.js addListener("/*js*/");` f := fourslash.NewFourslash(t, nil /*capabilities*/, content) f.VerifyCompletions(t, []string{"ts", "tsx", "js"}, &fourslash.CompletionsExpectedList{ IsIncomplete: false, ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ CommitCharacters: &DefaultCommitCharacters, EditRange: Ignored, }, Items: &fourslash.CompletionsExpectedItems{ Exact: []fourslash.CompletionsExpectedItem{ "", "drag", "dragenter", }, }, }) f.Insert(t, "drag") f.VerifyCompletions(t, []string{"ts", "tsx", "js"}, &fourslash.CompletionsExpectedList{ IsIncomplete: false, ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{ CommitCharacters: &DefaultCommitCharacters, EditRange: Ignored, }, Items: &fourslash.CompletionsExpectedItems{ Exact: []fourslash.CompletionsExpectedItem{ "", "drag", "dragenter", }, }, }) }