Skip to content

Commit

Permalink
Add test for Issue mmkal#53: .omit() behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 committed Mar 11, 2024
1 parent c9d016e commit b57153f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,3 +714,20 @@ test('PrintType', () => {
expectTypeOf<a.PrintType<() => {}>>().toEqualTypeOf<'function'>()
expectTypeOf<a.PrintType<any>>().toBeNever()
})

test('Issue #53: `.omit()` should work similarly to `Omit`', () => {
// https://github.com/mmkal/expect-type/issues/53

type Loading = {
state: 'loading'
}

type Failed = {
state: 'failed'
code: number
}

expectTypeOf<Omit<Loading | Failed, 'code'>>().toEqualTypeOf<{state: 'loading' | 'failed'}>()

expectTypeOf<Loading | Failed>().omit<'code'>().toEqualTypeOf<{state: 'loading' | 'failed'}>()
})

0 comments on commit b57153f

Please # to comment.