feat(typescript-types): Add KeyPath<T, Separator = '.'>
This commit is contained in:
11
packages/typescript-types/test/key-path.tst.ts
Normal file
11
packages/typescript-types/test/key-path.tst.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { KeyPath } from '@/key-path.js'
|
||||
import { expect } from 'tstyche'
|
||||
|
||||
expect<KeyPath<''>>().type.toBe<[]>()
|
||||
expect<KeyPath<'Key'>>().type.toBe<['Key']>()
|
||||
expect<KeyPath<'Key.Path'>>().type.toBe<['Key', 'Path']>()
|
||||
expect<KeyPath<'Key.Path', '-'>>().type.toBe<['Key.Path']>()
|
||||
expect<KeyPath<'Key.Path-One', '-'>>().type.toBe<['Key.Path', 'One']>()
|
||||
|
||||
expect<KeyPath<any>>().type.toBe<[] | [string]>()
|
||||
expect<KeyPath<never>>().type.toBeAssignableWith<never>()
|
||||
Reference in New Issue
Block a user