is-kit 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -186,7 +186,9 @@ const isConfig = struct({
|
|
|
186
186
|
|
|
187
187
|
`optionalKey(guard)` means the property may be missing.
|
|
188
188
|
|
|
189
|
-
Use `struct(schema, { exact: true })` when extra
|
|
189
|
+
Use `struct(schema, { exact: true })` when extra own enumerable string keys
|
|
190
|
+
should be rejected. Exact mode follows `Object.keys(...)` semantics, so symbol
|
|
191
|
+
keys and non-enumerable properties are outside its key matching.
|
|
190
192
|
|
|
191
193
|
If the property must exist but the value may be `undefined`, use `optional(guard)` instead.
|
|
192
194
|
|
|
@@ -312,7 +314,13 @@ Here are the kinds of problems `is-kit` is especially good at solving:
|
|
|
312
314
|
### Typed object guard checks
|
|
313
315
|
|
|
314
316
|
```ts
|
|
315
|
-
import {
|
|
317
|
+
import {
|
|
318
|
+
isNumber,
|
|
319
|
+
isString,
|
|
320
|
+
optionalKey,
|
|
321
|
+
safeParse,
|
|
322
|
+
typedStruct
|
|
323
|
+
} from 'is-kit';
|
|
316
324
|
|
|
317
325
|
type PostResponse = ApiResponse<'/posts/{id}', 'get'>;
|
|
318
326
|
|
package/dist/index.d.mts
CHANGED
|
@@ -552,7 +552,8 @@ declare function optionalKey<G extends Predicate<unknown>>(guard: G): OptionalSc
|
|
|
552
552
|
* rejects extra keys when `exact: true`.
|
|
553
553
|
*
|
|
554
554
|
* @param schema Record of property guards.
|
|
555
|
-
* @param options When `{ exact: true }`, disallows
|
|
555
|
+
* @param options When `{ exact: true }`, disallows own enumerable string-key
|
|
556
|
+
* properties not in `schema`.
|
|
556
557
|
* @returns Predicate that narrows to the inferred struct type.
|
|
557
558
|
*/
|
|
558
559
|
declare function struct<const S extends SchemaShape<S>>(schema: S, options?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -552,7 +552,8 @@ declare function optionalKey<G extends Predicate<unknown>>(guard: G): OptionalSc
|
|
|
552
552
|
* rejects extra keys when `exact: true`.
|
|
553
553
|
*
|
|
554
554
|
* @param schema Record of property guards.
|
|
555
|
-
* @param options When `{ exact: true }`, disallows
|
|
555
|
+
* @param options When `{ exact: true }`, disallows own enumerable string-key
|
|
556
|
+
* properties not in `schema`.
|
|
556
557
|
* @returns Predicate that narrows to the inferred struct type.
|
|
557
558
|
*/
|
|
558
559
|
declare function struct<const S extends SchemaShape<S>>(schema: S, options?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "is-kit",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "Make 'isXXX' easier. Let's make your code type safe and more readable!",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -38,20 +38,21 @@
|
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/jest": "^30.0.0",
|
|
41
|
-
"jest": "^30.
|
|
42
|
-
"lefthook": "^2.
|
|
43
|
-
"oxfmt": "^0.
|
|
44
|
-
"oxlint": "^1.
|
|
45
|
-
"ts-jest": "^29.4.
|
|
41
|
+
"jest": "^30.4.2",
|
|
42
|
+
"lefthook": "^2.1.9",
|
|
43
|
+
"oxfmt": "^0.55.0",
|
|
44
|
+
"oxlint": "^1.70.0",
|
|
45
|
+
"ts-jest": "^29.4.11",
|
|
46
46
|
"tsd": "^0.33.0",
|
|
47
47
|
"tsup": "^8.5.0",
|
|
48
|
-
"typedoc": "^0.28.
|
|
49
|
-
"typescript": "^
|
|
48
|
+
"typedoc": "^0.28.19",
|
|
49
|
+
"typescript": "^6.0.3"
|
|
50
50
|
},
|
|
51
51
|
"tsd": {
|
|
52
52
|
"directory": "tests-d",
|
|
53
53
|
"compilerOptions": {
|
|
54
|
-
"baseUrl": "."
|
|
54
|
+
"baseUrl": ".",
|
|
55
|
+
"ignoreDeprecations": "6.0"
|
|
55
56
|
}
|
|
56
57
|
},
|
|
57
58
|
"scripts": {
|