-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ Add the NotEquals type - Checks if a type does not equal anot…
…her type
- Loading branch information
1 parent
a334fde
commit c5bb362
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@crbroughton/ts-test-utils": minor | ||
--- | ||
|
||
Add the NotEquals type - Checks if a type does not equal another type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint-disable unused-imports/no-unused-vars */ | ||
import { describe, it } from 'bun:test' | ||
import type { Expect, NotEquals } from '../index' | ||
|
||
describe('NotEquals tests', () => { | ||
it('Passes the equality test when the types are not equal', () => { | ||
type ResultBoolean = Expect<NotEquals<true, false>> | ||
// ^? | ||
type ResultRecord = Expect<NotEquals<{ id: number }, { id: string }>> | ||
// ^? | ||
}) | ||
it('Fails the equality test when the types are equal', () => { | ||
// @ts-expect-error - Boolean values failing the equality checker | ||
type ResultBoolean = Expect<NotEquals<true, true>> | ||
// ^? | ||
// @ts-expect-error - Object / Record failing the equality checker | ||
type ResultRecord = Expect<NotEquals<{ id: number }, { id: number }>> | ||
// ^? | ||
}) | ||
}) |