Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

展开 Typescript 类型定义 #45

Open
Silence-dream opened this issue Jun 9, 2023 · 1 comment
Open

展开 Typescript 类型定义 #45

Silence-dream opened this issue Jun 9, 2023 · 1 comment

Comments

@Silence-dream
Copy link
Owner

type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;

type ExpandRecursively<T> = T extends object
  ? T extends infer O ? { [K in keyof O]: ExpandRecursively<O[K]> } : never
  : T;
@Silence-dream
Copy link
Owner Author

ts 类型重写

export declare type Overwrite<T, U> = T extends unknown ? Pick<T, Exclude<keyof T, keyof U>> & U : never;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant