ts-gems 4.0.1 → 4.0.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/docs/api/omit.md CHANGED
@@ -9,10 +9,11 @@ convention](../api.md#the-deep--deeper-convention) for `DeepOmitTypes`/
9
9
 
10
10
  ## `StrictOmit<T, X>`
11
11
 
12
- Like the built-in `Omit<T, K>`, but also drops any remaining key whose value
13
- type is `never` (after stripping `undefined`) symmetric with
14
- [`StrictPick`](pick.md#strictpickt-x), so picking and omitting the same key
15
- set never disagree about `never`-typed properties.
12
+ Like the built-in `Omit<T, K>`, but `X` is constrained to `keyof T`, so a
13
+ typo in the key you're omitting is a compile error instead of a silent
14
+ no-op. Unlike [`StrictPick`](pick.md#strictpickt-x), it does **not** also
15
+ drop `never`-typed keys only the key(s) named in `X` are removed, by
16
+ identity, regardless of their value type.
16
17
 
17
18
  ```ts
18
19
  import type { StrictOmit } from 'ts-gems';
@@ -24,7 +25,7 @@ interface Row {
24
25
  }
25
26
 
26
27
  type Result = StrictOmit<Row, 'b'>;
27
- // { a?: number } - `c` is dropped too, it's `never`
28
+ // { a?: number; c: never } - only `b` is removed
28
29
  ```
29
30
 
30
31
  ## `OmitFunctions<T>`
package/docs/api/pick.md CHANGED
@@ -7,9 +7,11 @@ See [Omit](omit.md) for the inverse operations.
7
7
 
8
8
  ## `StrictPick<T, X>`
9
9
 
10
- Like the built-in `Pick<T, K>`, but also drops any selected key whose value
11
- type is `never` (after stripping `undefined`) consistent with how the rest
12
- of the library treats `never`-typed properties as "absent".
10
+ Like the built-in `Pick<T, K>`, but `X` is constrained to `keyof T`, so a
11
+ typo in the key you're picking is a compile error instead of silently
12
+ producing `never`. It only selects by key identity — it does **not** also
13
+ drop `never`-typed keys, so it stays correct when `T` is still an open
14
+ generic type parameter (e.g. used inside another generic function).
13
15
 
14
16
  ```ts
15
17
  import type { StrictPick } from 'ts-gems';
@@ -21,7 +23,7 @@ interface Row {
21
23
  }
22
24
 
23
25
  type Result = StrictPick<Row, 'a' | 'c'>;
24
- // { a?: number } - `c` is dropped, it's `never`
26
+ // { a?: number; c: never } - both named keys are kept
25
27
  ```
26
28
 
27
29
  ## `PickFunctions<T>`
package/docs/api.md CHANGED
@@ -1,10 +1,10 @@
1
1
  <!--
2
2
  docs-baseline
3
- git-commit: 66d9af96d83e33978dd84297e490d158350dd865
4
- package-version: 4.0.0
3
+ git-commit: 27bbe999f45fa24fe4e1d7d32d5639defa285bdc
4
+ package-version: 4.0.1
5
5
  date: 2026-09-09
6
6
  verified-against: lib/
7
- diff-command: git diff 66d9af96d83e33978dd84297e490d158350dd865..HEAD -- lib/
7
+ diff-command: git diff 27bbe999f45fa24fe4e1d7d32d5639defa285bdc..HEAD -- lib/
8
8
  -->
9
9
 
10
10
  <p align="center">
package/lib/omit.d.ts CHANGED
@@ -7,16 +7,7 @@ import { IfFunction, IfNever, IfTuple } from './type-check.js';
7
7
  * while preserving strict type checking.
8
8
  */
9
9
  export type StrictOmit<T, X extends keyof T> = {
10
- [
11
- K in keyof T as Or<
12
- // Omit never keys
13
- IfNever<Exclude<T[K], undefined>>,
14
- // Omit X
15
- K extends X ? true : false
16
- > extends true
17
- ? never
18
- : K
19
- ]: T[K];
10
+ [K in keyof T as K extends X ? never : K]: T[K];
20
11
  };
21
12
 
22
13
  /**
package/lib/pick.d.ts CHANGED
@@ -13,16 +13,7 @@ import {
13
13
  * while preserving strict type checking.
14
14
  */
15
15
  export type StrictPick<T, X extends keyof T> = {
16
- [
17
- K in keyof T as Or<
18
- // Omit never keys
19
- IfNever<Exclude<T[K], undefined>>,
20
- // Omit X
21
- K extends X ? false : true
22
- > extends true
23
- ? never
24
- : K
25
- ]: T[K];
16
+ [K in keyof T as K extends X ? K : never]: T[K];
26
17
  };
27
18
 
28
19
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ts-gems",
3
3
  "description": "Valuable typing extensions for TypeScript",
4
- "version": "4.0.1",
4
+ "version": "4.0.2",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "module": "./lib/index.js",