feat(typescript-types): Add If<Test,TrueBranch,FalseBranch>
This commit is contained in:
10
packages/typescript-types/test/if.tst.ts
Normal file
10
packages/typescript-types/test/if.tst.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { If } from '@/if.js'
|
||||
import { expect } from 'tstyche'
|
||||
|
||||
expect<If<true, 'Y', 'N'>>().type.toBe<'Y'>()
|
||||
|
||||
expect<If<false, 'Y', 'N'>>().type.toBe<'N'>()
|
||||
expect<If<never, 'Y', 'N'>>().type.toBe<'N'>()
|
||||
expect<If<any, 'Y', 'N'>>().type.toBe<'N'>()
|
||||
|
||||
expect<If<boolean, 'Y', 'N'>>().type.toBe<'Y' | 'N'>()
|
||||
Reference in New Issue
Block a user