Skip to content

Commit e902b0a

Browse files
committed
💪 Improve tests/docs/types of is module
1 parent 34770c0 commit e902b0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+752
-704
lines changed

_annotation.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export type AsReadonly<T = unknown> = {
4646
/**
4747
* Annotation for predObj.
4848
*/
49-
export type WithPredObj<T extends Record<PropertyKey, Predicate<unknown>>> = {
49+
export type IsPredObj<
50+
T extends Record<PropertyKey, Predicate<unknown>> = Record<
51+
PropertyKey,
52+
Predicate<unknown>
53+
>,
54+
> = {
5055
predObj: T;
5156
};

is/__snapshots__/array_of_test.ts.snap

Lines changed: 0 additions & 5 deletions
This file was deleted.

is/__snapshots__/instance_of_test.ts.snap

Lines changed: 0 additions & 5 deletions
This file was deleted.

is/__snapshots__/intersection_of_test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
export const snapshot = {};
22

3-
snapshot[`isIntersectionOf<T> > returns properly named function 1`] = `
3+
snapshot[`isIntersectionOf<T> > returns properly named predicate function 1`] = `"isString"`;
4+
5+
snapshot[`isIntersectionOf<T> > returns properly named predicate function 2`] = `
46
"isObjectOf({
57
a: isNumber,
68
b: isString
79
})"
810
`;
911
10-
snapshot[`isIntersectionOf<T> > returns properly named function 2`] = `"isString"`;
11-
12-
snapshot[`isIntersectionOf<T> > returns properly named function 3`] = `
12+
snapshot[`isIntersectionOf<T> > returns properly named predicate function 3`] = `
1313
"isIntersectionOf([
1414
isFunction,
1515
isObjectOf({b: isString})

is/__snapshots__/literal_of_test.ts.snap

Lines changed: 0 additions & 15 deletions
This file was deleted.

is/__snapshots__/literal_one_of_test.ts.snap

Lines changed: 0 additions & 3 deletions
This file was deleted.

is/__snapshots__/map_of_test.ts.snap

Lines changed: 0 additions & 9 deletions
This file was deleted.

is/__snapshots__/object_of_test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
export const snapshot = {};
22

3-
snapshot[`isObjectOf<T> > returns properly named function 1`] = `
3+
snapshot[`isObjectOf<T> > returns properly named predicate function 1`] = `
44
"isObjectOf({
55
a: isNumber,
66
b: isString,
77
c: isBoolean
88
})"
99
`;
1010
11-
snapshot[`isObjectOf<T> > returns properly named function 2`] = `"isObjectOf({a: a})"`;
11+
snapshot[`isObjectOf<T> > returns properly named predicate function 2`] = `"isObjectOf({a: a})"`;
1212
13-
snapshot[`isObjectOf<T> > returns properly named function 3`] = `
13+
snapshot[`isObjectOf<T> > returns properly named predicate function 3`] = `
1414
"isObjectOf({
1515
a: isObjectOf({
1616
b: isObjectOf({c: isBoolean})

is/__snapshots__/omit_of_test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
export const snapshot = {};
22

3-
snapshot[`isOmitOf<T, K> > returns properly named function 1`] = `
3+
snapshot[`isOmitOf<T, K> > returns properly named predicate function 1`] = `
44
"isObjectOf({
55
a: isNumber,
66
c: isBoolean
77
})"
88
`;
99

10-
snapshot[`isOmitOf<T, K> > returns properly named function 2`] = `"isObjectOf({a: isNumber})"`;
10+
snapshot[`isOmitOf<T, K> > returns properly named predicate function 2`] = `"isObjectOf({a: isNumber})"`;

is/__snapshots__/parameters_of_test.ts.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
export const snapshot = {};
22

3-
snapshot[`isParametersOf<T> > returns properly named function 1`] = `
3+
snapshot[`isParametersOf<T> > returns properly named predicate function 1`] = `
44
"isParametersOf([
55
isNumber,
66
isString,
77
asOptional(isBoolean)
88
])"
99
`;
1010
11-
snapshot[`isParametersOf<T> > returns properly named function 2`] = `"isParametersOf([(anonymous)])"`;
11+
snapshot[`isParametersOf<T> > returns properly named predicate function 2`] = `"isParametersOf([(anonymous)])"`;
1212
13-
snapshot[`isParametersOf<T> > returns properly named function 3`] = `"isParametersOf([])"`;
13+
snapshot[`isParametersOf<T> > returns properly named predicate function 3`] = `"isParametersOf([])"`;
1414
15-
snapshot[`isParametersOf<T> > returns properly named function 4`] = `
15+
snapshot[`isParametersOf<T> > returns properly named predicate function 4`] = `
1616
"isParametersOf([
1717
isParametersOf([
1818
isParametersOf([
@@ -24,19 +24,19 @@ snapshot[`isParametersOf<T> > returns properly named function 4`] = `
2424
])"
2525
`;
2626
27-
snapshot[`isParametersOf<T, E> > returns properly named function 1`] = `
27+
snapshot[`isParametersOf<T, E> > returns properly named predicate function 1`] = `
2828
"isParametersOf([
2929
isNumber,
3030
isString,
3131
asOptional(isBoolean)
3232
], isArray)"
3333
`;
3434
35-
snapshot[`isParametersOf<T, E> > returns properly named function 2`] = `"isParametersOf([(anonymous)], isArrayOf(isString))"`;
35+
snapshot[`isParametersOf<T, E> > returns properly named predicate function 2`] = `"isParametersOf([(anonymous)], isArrayOf(isString))"`;
3636
37-
snapshot[`isParametersOf<T, E> > returns properly named function 3`] = `"isParametersOf([], isArrayOf(isString))"`;
37+
snapshot[`isParametersOf<T, E> > returns properly named predicate function 3`] = `"isParametersOf([], isArrayOf(isString))"`;
3838
39-
snapshot[`isParametersOf<T, E> > returns properly named function 4`] = `
39+
snapshot[`isParametersOf<T, E> > returns properly named predicate function 4`] = `
4040
"isParametersOf([
4141
isParametersOf([
4242
isParametersOf([

0 commit comments

Comments
 (0)