mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
stupid fmt
This commit is contained in:
+36
-27
@@ -1358,13 +1358,13 @@ export type Camelize<T> = {
|
||||
|
||||
/** Non object primitives */
|
||||
export type Primitive =
|
||||
| string
|
||||
| number
|
||||
| symbol
|
||||
| bigint
|
||||
| boolean
|
||||
| undefined
|
||||
| null;
|
||||
| string
|
||||
| number
|
||||
| symbol
|
||||
| bigint
|
||||
| boolean
|
||||
| undefined
|
||||
| null;
|
||||
// | object <- don't make object a primitive
|
||||
|
||||
/**
|
||||
@@ -1374,12 +1374,12 @@ export type Primitive =
|
||||
* export const o: object = []; // no error
|
||||
*/
|
||||
export type ObjectLiteral<T = unknown> = {
|
||||
[K in PropertyKey]: T;
|
||||
[K in PropertyKey]: T;
|
||||
};
|
||||
|
||||
/** Array with no utilty methods, aka Object.create(null) */
|
||||
export type ArrayWithNoPrototype<T> = {
|
||||
[index:number]: T | ArrayWithNoPrototype<T>;
|
||||
[index: number]: T | ArrayWithNoPrototype<T>;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1388,18 +1388,27 @@ export type ArrayWithNoPrototype<T> = {
|
||||
* @example
|
||||
* export type RequestData = Record<string, AnythingBut<bigint>>;
|
||||
*/
|
||||
export type AnythingBut<T> = Exclude<Primitive | {
|
||||
[K in PropertyKey]: AnythingBut<T>;
|
||||
} | ArrayWithNoPrototype<Primitive | {
|
||||
[K in PropertyKey]: AnythingBut<T>;
|
||||
}>, T>;
|
||||
export type AnythingBut<T> = Exclude<
|
||||
| Primitive
|
||||
| {
|
||||
[K in PropertyKey]: AnythingBut<T>;
|
||||
}
|
||||
| ArrayWithNoPrototype<
|
||||
| Primitive
|
||||
| {
|
||||
[K in PropertyKey]: AnythingBut<T>;
|
||||
}
|
||||
>,
|
||||
T
|
||||
>;
|
||||
|
||||
/**
|
||||
* object identity type
|
||||
*/
|
||||
export type Id<T> = T extends infer U ? {
|
||||
[K in keyof U]: U[K];
|
||||
} : never;
|
||||
[K in keyof U]: U[K];
|
||||
}
|
||||
: never;
|
||||
|
||||
export type KeysWithUndefined<T> = {
|
||||
[K in keyof T]-?: undefined extends T[K] ? K
|
||||
@@ -1407,25 +1416,25 @@ export type KeysWithUndefined<T> = {
|
||||
: never;
|
||||
}[keyof T];
|
||||
|
||||
type OptionalizeAux<T extends object> = Id<{
|
||||
type OptionalizeAux<T extends object> = Id<
|
||||
& {
|
||||
[K in KeysWithUndefined<T>]?: Optionalize<T[K]>;
|
||||
} & {
|
||||
}
|
||||
& {
|
||||
[K in Exclude<keyof T, KeysWithUndefined<T>>]: T[K] extends ObjectLiteral ? Optionalize<T[K]> : T[K];
|
||||
}>;
|
||||
}
|
||||
>;
|
||||
|
||||
/**
|
||||
* Makes all of properties in T optional when they're null | undefined
|
||||
* it is recursive
|
||||
*/
|
||||
export type Optionalize<T> = T extends object
|
||||
? T extends Array<unknown>
|
||||
? number extends T["length"]
|
||||
? T[number] extends object
|
||||
? Array<OptionalizeAux<T[number]>>
|
||||
: T
|
||||
: Partial<T>
|
||||
: OptionalizeAux<T>
|
||||
: T;
|
||||
? T extends Array<unknown> ? number extends T["length"] ? T[number] extends object ? Array<OptionalizeAux<T[number]>>
|
||||
: T
|
||||
: Partial<T>
|
||||
: OptionalizeAux<T>
|
||||
: T;
|
||||
|
||||
export type PickPartial<T, K extends keyof T> =
|
||||
& {
|
||||
|
||||
Reference in New Issue
Block a user