Skip to content

Commit 1db64ef

Browse files
committed
feat: 🔖 0.6.1 - Fix IsArray and IsNonArray spelling to match rest of types, add test coverage to IsNonArray
1 parent c5854a6 commit 1db64ef

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @crbroughton/ts-test-utils
22

3+
## 0.6.1
4+
5+
### Patch Changes
6+
7+
- Fix IsArray and IsNonArray spelling to match rest of types, add test coverage to IsNonArray
8+
39
## 0.6.0
410

511
### Minor Changes

index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export type Assignable<Actual, Assigned extends Actual> = Assigned extends Actua
1616

1717
export type Extends<Actual, Extension> = Extension extends Actual ? true : false
1818

19-
export type isArray<Actual> = Actual extends any[] ? true : false
19+
export type IsArray<Actual> = Actual extends any[] ? true : false
2020

21-
export type isNonArray<Actual> = isArray<Actual> extends true ? false : true
21+
export type IsNonArray<Actual> = IsArray<Actual> extends true ? false : true
2222

2323
export type Length<Actual extends readonly any[]> = Actual['length']
2424

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@crbroughton/ts-test-utils",
33
"type": "module",
4-
"version": "0.6.0",
4+
"version": "0.6.1",
55
"description": "A collection of testing helper types",
66
"author": "Craig R Broughton",
77
"license": "MIT",

tests/IsNonArray.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* eslint-disable unused-imports/no-unused-vars */
2+
import { describe, it } from 'bun:test'
3+
import type { Expect, IsNonArray } from '../index'
4+
5+
describe('IsNonArray tests', () => {
6+
it('Passes the IsNonArray test when the type is not an array', () => {
7+
type Result = Expect<IsNonArray<{ id: number }>>
8+
// ^?
9+
})
10+
it('Failed the IsNonArray test when the type is an array', () => {
11+
// @ts-expect-error - Fails the exclusion
12+
type Result = Expect<IsNonArray<{ id: string }[]>>
13+
// ^?
14+
})
15+
})

tests/isArray.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/* eslint-disable unused-imports/no-unused-vars */
22
import { describe, it } from 'bun:test'
3-
import type { Expect, isArray } from '../index'
3+
import type { Expect, IsArray } from '../index'
44

55
describe('isArray tests', () => {
66
it('Passes the isArray test when the type is an array', () => {
7-
type Result = Expect<isArray<{ id: number }[]>>
7+
type Result = Expect<IsArray<{ id: number }[]>>
88
// ^?
99
})
1010
it('Failed the isArray test when the type is not an array', () => {
1111
// @ts-expect-error - Fails the exclusion
12-
type Result = Expect<isArray<{ id: string }>>
12+
type Result = Expect<IsArray<{ id: string }>>
1313
// ^?
1414
})
1515
})

0 commit comments

Comments
 (0)