Skip to content

Commit

Permalink
test: add AnyRecord behavior showcase
Browse files Browse the repository at this point in the history
  • Loading branch information
unional committed Sep 13, 2023
1 parent afac18a commit 0771911
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions type-plus/ts/object/any_record.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ it('use as type criteria', () => {
// @ts-expect-error
testType.equal<X<never>, never>(true)
})

it('shows how AnyRecord behaves as criteria against primitive types', () => {
testType.equal<Boolean extends AnyRecord ? true : false, true>(true)
testType.equal<Number extends AnyRecord ? true : false, true>(true)
testType.equal<String extends AnyRecord ? true : false, true>(true)
testType.equal<Function extends AnyRecord ? true : false, true>(true)
testType.equal<Object extends AnyRecord ? true : false, true>(true)
testType.equal<Symbol extends AnyRecord ? true : false, true>(true)
testType.equal<BigInt extends AnyRecord ? true : false, true>(true)
})

0 comments on commit 0771911

Please sign in to comment.