76 lines
2.4 KiB
Plaintext
76 lines
2.4 KiB
Plaintext
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
exports[`conditonal-types.ts 1`] = `
|
|
====================================options=====================================
|
|
parsers: ["typescript"]
|
|
printWidth: 80
|
|
| printWidth
|
|
=====================================input======================================
|
|
export type DeepReadonly<T> = T extends any[] ? DeepReadonlyArray<T[number]> : T extends object ? DeepReadonlyObject<T> : T;
|
|
|
|
type NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T];
|
|
|
|
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}
|
|
|
|
type DeepReadonlyObject<T> = {
|
|
readonly [P in NonFunctionPropertyNames<T>]: DeepReadonly<T[P]>;
|
|
};
|
|
|
|
type TypeName<T> =
|
|
T extends string ? "string" :
|
|
T extends number ? "number" :
|
|
T extends boolean ? "boolean" :
|
|
T extends undefined ? "undefined" :
|
|
T extends Function ? "function" :
|
|
"object";
|
|
|
|
=====================================output=====================================
|
|
export type DeepReadonly<T> = T extends any[]
|
|
? DeepReadonlyArray<T[number]>
|
|
: T extends object
|
|
? DeepReadonlyObject<T>
|
|
: T;
|
|
|
|
type NonFunctionPropertyNames<T> = {
|
|
[K in keyof T]: T[K] extends Function ? never : K
|
|
}[keyof T];
|
|
|
|
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}
|
|
|
|
type DeepReadonlyObject<T> = {
|
|
readonly [P in NonFunctionPropertyNames<T>]: DeepReadonly<T[P]>;
|
|
};
|
|
|
|
type TypeName<T> = T extends string
|
|
? "string"
|
|
: T extends number
|
|
? "number"
|
|
: T extends boolean
|
|
? "boolean"
|
|
: T extends undefined
|
|
? "undefined"
|
|
: T extends Function
|
|
? "function"
|
|
: "object";
|
|
|
|
================================================================================
|
|
`;
|
|
|
|
exports[`infer-type.ts 1`] = `
|
|
====================================options=====================================
|
|
parsers: ["typescript"]
|
|
printWidth: 80
|
|
| printWidth
|
|
=====================================input======================================
|
|
type TestReturnType<T extends (...args: any[]) => any> = T extends (...args: any[]) => infer R ? R : any;
|
|
|
|
=====================================output=====================================
|
|
type TestReturnType<T extends (...args: any[]) => any> = T extends (
|
|
...args: any[]
|
|
) => infer R
|
|
? R
|
|
: any;
|
|
|
|
================================================================================
|
|
`;
|