We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a44dd46 commit 07aac53Copy full SHA for 07aac53
test/issue-91.ts
@@ -19,4 +19,18 @@ describe('template literal types', () => {
19
is<`foo${string}${number}bar${1 | 2 | 3}baz${number}asdf`>('foobar1bar2baz123asdf'), true
20
)
21
22
+ describe('key types', () => {
23
+ it('primitives get resolved to strings', () =>
24
+ assert.deepStrictEqual(is<{ [K in `foo${string}`]: any }>({foo: 'bar', baz: 'qux'}), true)
25
+ )
26
+ describe('unions', () => {
27
+ type Foo = { [K in `foo${'bar' | 'baz'}`]: any }
28
+ it('true', () =>
29
+ assert.deepStrictEqual(is<Foo>({foobar: 'bar', foobaz: 'qux'}), true)
30
31
+ it('false', () =>
32
+ assert.deepStrictEqual(is<Foo>({foo: 'bar', baz: 'qux'}), false)
33
34
+ })
35
36
})
0 commit comments