Skip to content

Commit 04a2b51

Browse files
committed
[objarr] Type checks
1 parent 90cb3e6 commit 04a2b51

6 files changed

Lines changed: 640 additions & 474 deletions

File tree

src/@types/_internal/store/with-schemas/index.d.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import type {
2-
AnyArray,
3-
AnyObject,
4-
Id,
5-
} from '../../../common/with-schemas/index.d.ts';
1+
import type {Id} from '../../../common/with-schemas/index.d.ts';
62
import type {
73
Cell,
84
OptionalSchemas,
@@ -52,7 +48,7 @@ export type CellIsDefaultedFromSchema<
5248
Then,
5349
Else,
5450
> = Schema[TableId][CellId] extends {
55-
default: string | number | boolean | AnyObject | AnyArray;
51+
default: infer _;
5652
}
5753
? Then
5854
: Else;
@@ -87,7 +83,7 @@ export type ValueIsDefaultedFromSchema<
8783
Then,
8884
Else,
8985
> = Schema[ValueId] extends {
90-
default: string | number | boolean | AnyObject | AnyArray;
86+
default: infer _;
9187
}
9288
? Then
9389
: Else;

src/@types/common/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type Json = string;
99
export type AnyObject = {[key: string]: unknown};
1010

1111
/// AnyArray
12-
export type AnyArray = unknown[];
12+
export type AnyArray = unknown[] | readonly unknown[];
1313

1414
/// Ids
1515
export type Ids = Id[];

src/@types/common/with-schemas/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export type Json = string;
2121
export type AnyObject = {[key: string]: unknown};
2222

2323
/// AnyArray
24-
export type AnyArray = unknown[];
24+
export type AnyArray = unknown[] | readonly unknown[];
2525

2626
/// Ids
2727
export type Ids = Id[];

src/@types/store/with-schemas/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
997997
tableId: TableId,
998998
rowId: Id,
999999
cellId: CellId,
1000-
): CellOrUndefined<Schemas[0], TableId, CellId>;
1000+
): DefaultedCellFromSchema<Schemas[0], TableId, CellId>;
10011001

10021002
/// Store.getValues
10031003
getValues(): Values<Schemas[1]>;

0 commit comments

Comments
 (0)