test(typescript-types): Test optional key path transformation

This commit is contained in:
T. R. Bernstein
2025-07-28 16:24:34 +02:00
parent 97a517737a
commit 9170f6856a

View File

@@ -4,6 +4,8 @@ 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?'>>().type.toBe<['Key?', 'Path?']>()
expect<KeyPath<'Key.Path', '-'>>().type.toBe<['Key.Path']>()
expect<KeyPath<'Key.Path-One', '-'>>().type.toBe<['Key.Path', 'One']>()