kittenipc/kitcom/internal/tsgo/fourslash/tests/gen/completionsGenericIndexedAccess6_test.go
2025-10-15 10:12:44 +03:00

47 lines
1.3 KiB
Go

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/lsp/lsproto"
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/testutil"
)
func TestCompletionsGenericIndexedAccess6(t *testing.T) {
t.Parallel()
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @Filename: component.tsx
interface CustomElements {
'component-one': {
foo?: string;
},
'component-two': {
bar?: string;
}
}
type Options<T extends keyof CustomElements> = { kind: T } & Required<{ x: CustomElements[(T extends string ? T : never) & string] }['x']>;
declare function Component<T extends keyof CustomElements>(props: Options<T>): void;
const c = <Component /**/ kind="component-one" />`
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
f.VerifyCompletions(t, "", &fourslash.CompletionsExpectedList{
IsIncomplete: false,
ItemDefaults: &fourslash.CompletionsExpectedItemDefaults{
CommitCharacters: &DefaultCommitCharacters,
EditRange: Ignored,
},
Items: &fourslash.CompletionsExpectedItems{
Exact: []fourslash.CompletionsExpectedItem{
&lsproto.CompletionItem{
Label: "foo",
},
},
},
})
}