@hey-api/types
Advanced tools
| /** | ||
| * An object with string keys and unknown values. | ||
| */ | ||
| export type AnyObject = Record<string, unknown>; | ||
| /** | ||
| * An arbitrary string type. | ||
| */ | ||
| export type AnyString = string & {}; | ||
| /** | ||
| * Converts all top-level ReadonlyArray properties to Array (shallow). | ||
| */ | ||
| export type ArrayOnly<T> = { | ||
| [K in keyof T]: ToArray<T[K]>; | ||
| }; | ||
| /** | ||
| * Recursively makes all non-function properties optional. | ||
| */ | ||
| export type DeepPartial<T> = { | ||
| [K in keyof T]?: T[K] extends (...args: Array<any>) => any ? T[K] : T[K] extends object ? DeepPartial<T[K]> : T[K]; | ||
| }; | ||
| /** | ||
| * Accepts a value, a function returning a value, or a function returning a promise of a value. | ||
| */ | ||
| export type LazyOrAsync<T> = T | (() => MaybePromise<T>); | ||
| /** | ||
| * Accepts a value or a readonly array of values of type T. | ||
| */ | ||
| export type MaybeArray<T> = T | ReadonlyArray<T>; | ||
| /** | ||
| * Accepts a value or a function returning a value. | ||
| */ | ||
| export type MaybeFunc<T extends (...args: Array<any>) => any> = T | ReturnType<T>; | ||
| /** | ||
| * Accepts a value or a promise of a value. | ||
| */ | ||
| export type MaybePromise<T> = T | Promise<T>; | ||
| /** | ||
| * Converts all top-level Array properties to ReadonlyArray (shallow). | ||
| */ | ||
| export type ReadonlyArrayOnly<T> = { | ||
| [K in keyof T]: ToReadonlyArray<T[K]>; | ||
| }; | ||
| /** | ||
| * Converts ReadonlyArray<T> to Array<T>, preserving unions. | ||
| */ | ||
| export type ToArray<T> = T extends ReadonlyArray<infer U> ? Array<U> : T; | ||
| /** | ||
| * Converts Array<T> to ReadonlyArray<T>, preserving unions. | ||
| */ | ||
| export type ToReadonlyArray<T> = T extends ReadonlyArray<infer U> ? ReadonlyArray<U> : T; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,GAA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AAEF;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAC3B,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC"} |
+21
-4
| { | ||
| "name": "@hey-api/types", | ||
| "version": "0.1.2", | ||
| "version": "0.1.3", | ||
| "description": "Shared utility types.", | ||
| "type": "module", | ||
| "types": "./src/index.ts", | ||
| "types": "./dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts" | ||
| }, | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "files": [ | ||
| "src" | ||
| "dist" | ||
| ], | ||
@@ -18,3 +24,14 @@ "homepage": "https://heyapi.dev/", | ||
| }, | ||
| "license": "MIT" | ||
| "license": "MIT", | ||
| "peerDependencies": { | ||
| "typescript": ">=5.5.3" | ||
| }, | ||
| "devDependencies": { | ||
| "typescript": "5.9.3" | ||
| }, | ||
| "scripts": { | ||
| "build": "tsc --build", | ||
| "dev": "tsc --build --watch", | ||
| "typecheck": "tsc --noEmit" | ||
| } | ||
| } |
-62
| /** | ||
| * An object with string keys and unknown values. | ||
| */ | ||
| export type AnyObject = Record<string, unknown>; | ||
| /** | ||
| * Converts all top-level ReadonlyArray properties to Array (shallow). | ||
| */ | ||
| export type ArrayOnly<T> = { | ||
| [K in keyof T]: ToArray<T[K]>; | ||
| }; | ||
| /** | ||
| * Recursively makes all non-function properties optional. | ||
| */ | ||
| export type DeepPartial<T> = { | ||
| [K in keyof T]?: T[K] extends (...args: Array<any>) => any | ||
| ? T[K] | ||
| : T[K] extends object | ||
| ? DeepPartial<T[K]> | ||
| : T[K]; | ||
| }; | ||
| /** | ||
| * Accepts a value, a function returning a value, or a function returning a promise of a value. | ||
| */ | ||
| export type LazyOrAsync<T> = T | (() => MaybePromise<T>); | ||
| /** | ||
| * Accepts a value or a readonly array of values of type T. | ||
| */ | ||
| export type MaybeArray<T> = T | ReadonlyArray<T>; | ||
| /** | ||
| * Accepts a value or a function returning a value. | ||
| */ | ||
| export type MaybeFunc<T extends (...args: Array<any>) => any> = | ||
| | T | ||
| | ReturnType<T>; | ||
| /** | ||
| * Accepts a value or a promise of a value. | ||
| */ | ||
| export type MaybePromise<T> = T | Promise<T>; | ||
| /** | ||
| * Converts all top-level Array properties to ReadonlyArray (shallow). | ||
| */ | ||
| export type ReadonlyArrayOnly<T> = { | ||
| [K in keyof T]: ToReadonlyArray<T[K]>; | ||
| }; | ||
| /** | ||
| * Converts ReadonlyArray<T> to Array<T>, preserving unions. | ||
| */ | ||
| export type ToArray<T> = T extends ReadonlyArray<infer U> ? Array<U> : T; | ||
| /** | ||
| * Converts Array<T> to ReadonlyArray<T>, preserving unions. | ||
| */ | ||
| export type ToReadonlyArray<T> = | ||
| T extends ReadonlyArray<infer U> ? ReadonlyArray<U> : T; |
4795
62.38%4
33.33%1
Infinity%1
Infinity%50
-5.66%