-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
32 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
type-plus/ts/array/array_plus.is_index_out_of_bound.spec.ts
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,31 @@ | ||
import { it } from '@jest/globals' | ||
import { testType, type ArrayPlus } from '../index.js' | ||
|
||
it('returns true for never', () => { | ||
testType.true<ArrayPlus.IsIndexOutOfBound<['a'], never>>(true) | ||
}) | ||
|
||
it('returns true for empty tuple', () => { | ||
testType.true<ArrayPlus.IsIndexOutOfBound<[], never>>(true) | ||
testType.true<ArrayPlus.IsIndexOutOfBound<[], 0>>(true) | ||
}) | ||
|
||
it('return false for array', () => { | ||
testType.false<ArrayPlus.IsIndexOutOfBound<any[], 0>>(true) | ||
testType.false<ArrayPlus.IsIndexOutOfBound<any[], 1>>(true) | ||
testType.false<ArrayPlus.IsIndexOutOfBound<any[], -1>>(true) | ||
}) | ||
|
||
it('returns true for out of bound index', () => { | ||
testType.true<ArrayPlus.IsIndexOutOfBound<['a'], 1>>(true) | ||
testType.true<ArrayPlus.IsIndexOutOfBound<['a'], -2>>(true) | ||
}) | ||
|
||
it('returns false for in bound index', () => { | ||
testType.false<ArrayPlus.IsIndexOutOfBound<['a'], 0>>(true) | ||
testType.false<ArrayPlus.IsIndexOutOfBound<['a'], -1>>(true) | ||
}) | ||
|
||
it('supports readonly array', () => { | ||
testType.true<ArrayPlus.IsIndexOutOfBound<readonly ['a'], 1>>(true) | ||
}) |
32 changes: 0 additions & 32 deletions
32
type-plus/ts/array/array_plus.is_is_index_out_of_bound.spec.ts
This file was deleted.
Oops, something went wrong.