type-fest 4.3.0 → 4.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-fest",
3
- "version": "4.3.0",
3
+ "version": "4.3.2",
4
4
  "description": "A collection of essential TypeScript types",
5
5
  "license": "(MIT OR CC0-1.0)",
6
6
  "repository": "sindresorhus/type-fest",
package/readme.md CHANGED
@@ -77,6 +77,8 @@ npm install type-fest
77
77
 
78
78
  *Requires TypeScript >=5.1*
79
79
 
80
+ *Works best with [`{strict: true}`](https://www.typescriptlang.org/tsconfig#strict) in your tsconfig.*
81
+
80
82
  ## Usage
81
83
 
82
84
  ```ts
@@ -291,10 +293,11 @@ type ShouldBeNever = IfAny<'not any', 'not never', 'never'>;
291
293
 
292
294
  *If you know one of our types by a different name, add it here for discovery.*
293
295
 
296
+ - `Prettify`- See [`Simplify`](https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts)
297
+ - `Expand`- See [`Simplify`](https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts)
294
298
  - `PartialBy` - See [`SetOptional`](https://github.com/sindresorhus/type-fest/blob/main/source/set-optional.d.ts)
295
299
  - `RecordDeep`- See [`Schema`](https://github.com/sindresorhus/type-fest/blob/main/source/schema.d.ts)
296
300
  - `Mutable`- See [`Writable`](https://github.com/sindresorhus/type-fest/blob/main/source/writable.d.ts)
297
- - `Prettify`- See [`Simplify`](https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts)
298
301
  - `RequireOnlyOne` - See [`RequireExactlyOne`](https://github.com/sindresorhus/type-fest/blob/main/source/require-exactly-one.d.ts)
299
302
  - `AtMostOne` - See [`RequireOneOrNone`](https://github.com/sindresorhus/type-fest/blob/main/source/require-one-or-none.d.ts)
300
303
 
@@ -189,9 +189,16 @@ type BaseKeyFilter<Type, Key extends keyof Type> = Key extends symbol
189
189
  ? never
190
190
  : Type[Key] extends symbol
191
191
  ? never
192
- : [(...arguments_: any[]) => any] extends [Type[Key]]
193
- ? never
194
- : Key;
192
+ /*
193
+ To prevent a problem where an object with only a `name` property is incorrectly treated as assignable to a function, we first check if the property is a record.
194
+ This check is necessary, because without it, if we don't verify whether the property is a record, an object with a type of `{name: any}` would return `never` due to its potential assignability to a function.
195
+ See: https://github.com/sindresorhus/type-fest/issues/657
196
+ */
197
+ : Type[Key] extends Record<string, unknown>
198
+ ? Key
199
+ : [(...arguments_: any[]) => any] extends [Type[Key]]
200
+ ? never
201
+ : Key;
195
202
 
196
203
  /**
197
204
  Returns the required keys.
@@ -1,6 +1,6 @@
1
1
  declare const tag: unique symbol;
2
2
 
3
- declare type TagContainer<Token> = {
3
+ export type TagContainer<Token> = {
4
4
  readonly [tag]: Token;
5
5
  };
6
6