type-fest
Advanced tools
Comparing version 4.14.0 to 4.15.0
@@ -12,2 +12,3 @@ // Basic | ||
export type {EmptyObject, IsEmptyObject} from './source/empty-object'; | ||
export type {IfEmptyObject} from './source/if-empty-object'; | ||
export type {NonEmptyObject} from './source/non-empty-object'; | ||
@@ -27,2 +28,3 @@ export type {UnknownRecord} from './source/unknown-record'; | ||
export type {RequireOneOrNone} from './source/require-one-or-none'; | ||
export type {SingleKeyObject} from './source/single-key-object'; | ||
export type {OmitIndexSignature} from './source/omit-index-signature'; | ||
@@ -29,0 +31,0 @@ export type {PickIndexSignature} from './source/pick-index-signature'; |
{ | ||
"name": "type-fest", | ||
"version": "4.14.0", | ||
"version": "4.15.0", | ||
"description": "A collection of essential TypeScript types", | ||
@@ -19,3 +19,2 @@ "license": "(MIT OR CC0-1.0)", | ||
"scripts": { | ||
"test:set-parameter-type": "tsc --noEmit test-d/set-parameter-type", | ||
"test:source-files-extension": "node script/test/source-files-extension.js", | ||
@@ -44,7 +43,6 @@ "test:tsc": "tsc", | ||
"devDependencies": { | ||
"@sindresorhus/tsconfig": "~0.7.0", | ||
"expect-type": "^0.15.0", | ||
"npm-run-all2": "^6.1.2", | ||
"tsd": "^0.28.1", | ||
"typescript": "^5.2.2", | ||
"tsd": "^0.31.0", | ||
"typescript": "~5.4.3", | ||
"xo": "^0.58.0" | ||
@@ -51,0 +49,0 @@ }, |
@@ -113,3 +113,2 @@ <div align="center"> | ||
- [`EmptyObject`](source/empty-object.d.ts) - Represents a strictly empty plain object, the `{}` value. | ||
- [`IsEmptyObject`](source/empty-object.d.ts) - Returns a `boolean` for whether the type is strictly equal to an empty plain object, the `{}` value. | ||
- [`NonEmptyObject`](source/non-empty-object.d.ts) - Represents an object with at least 1 non-optional key. | ||
@@ -129,2 +128,3 @@ - [`UnknownRecord`](source/unknown-record.d.ts) - Represents an object with `unknown` value. You probably want this instead of `{}`. | ||
- [`RequireOneOrNone`](source/require-one-or-none.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more, or none of the given keys. | ||
- [`SingleKeyObject`](source/single-key-object.d.ts) - Create a type that only accepts an object with a single key. | ||
- [`RequiredDeep`](source/required-deep.d.ts) - Create a deeply required version of another type. Use [`Required<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#requiredtype) if you only need one level deep. | ||
@@ -225,2 +225,3 @@ - [`PickDeep`](source/pick-deep.d.ts) - Pick properties from a deeply-nested object. Use [`Pick<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#picktype-keys) if you only need one level deep. | ||
- [`IsUnknown`](source/is-unknown.d.ts) - Returns a boolean for whether the given type is `unknown`. (Conditional version: [`IfUnknown`](source/if-unknown.d.ts).) | ||
- [`IsEmptyObject`](source/empty-object.d.ts) - Returns a boolean for whether the type is strictly equal to an empty plain object, the `{}` value. (Conditional version: [`IfEmptyObject`](source/if-empty-object.d.ts)) | ||
@@ -227,0 +228,0 @@ ### JSON |
@@ -33,7 +33,6 @@ /** | ||
*/ | ||
export type ConditionalKeys<Base, Condition> = NonNullable< | ||
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union. | ||
export type ConditionalKeys<Base, Condition> = | ||
{ | ||
// Map through all the keys of the given base type. | ||
[Key in keyof Base]: | ||
[Key in keyof Base]-?: | ||
// Pick only keys with types extending the given `Condition` type. | ||
@@ -47,3 +46,2 @@ Base[Key] extends Condition | ||
// Convert the produced object into a union type of the keys which passed the conditional test. | ||
}[keyof Base] | ||
>; | ||
}[keyof Base]; |
@@ -419,5 +419,7 @@ import type {Primitive} from './primitive'; | ||
export type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = | ||
T extends {(...arguments_: infer A): unknown; (...arguments_: any[]): unknown} | ||
? unknown[] extends A | ||
? false | ||
T extends {(...arguments_: infer A): unknown; (...arguments_: infer B): unknown} | ||
? B extends A | ||
? A extends B | ||
? false | ||
: true | ||
: true | ||
@@ -424,0 +426,0 @@ : false; |
357637
5
135
8606
972