Skip to content

Commit

Permalink
feat(type): Stringifyable
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD committed Jan 28, 2023
1 parent f028306 commit c2e0771
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"preconnect",
"preload",
"roundot",
"Stringifyable",
"Superfast",
"tnum",
"tsbuildinfo",
Expand Down
14 changes: 13 additions & 1 deletion core/type/src/type-helper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

export type Constructor<ClassType = Record<string, unknown>> = new (...args: any[]) => ClassType;
export type Constructor<T> = new (...args: any[]) => T;

export type MaybePromise<T> = T | Promise<T>;

export type OmitFirstParam<F> = F extends (x: any, ...args: infer A) => infer R ? (...args: A) => R : never;

/**
* Object that can be JSON.stringify.
*/
export type Stringifyable =
| string
| number
| boolean
| null
| undefined
| { [x: string]: Stringifyable }
| Array<Stringifyable>;

0 comments on commit c2e0771

Please sign in to comment.