Leanote's Blog
I love Leanote!
Toggle navigation
Leanote's Blog
Home
Chrome
Git
Linux
Windows
Others
工具大全
VsCode
Expo
Html
JavaScript
Npm
Node
Mock
React-Native
React
TypeScript
小程序
插件
正则
Dva
Ant-Design-React
Umi
Vue
Vux
Ant-Design-Vue
Http
Java
flutter
开发小工具
About Me
Archives
Tags
TS二选一
2023-03-21 17:04:57
18
0
0
admin
``` export type FilterOptional<T> = Pick< T, Exclude< { [K in keyof T]: T extends Record<K, T[K]> ? K : never }[keyof T], undefined > > export type FilterNotOptional<T> = Pick< T, Exclude< { [K in keyof T]: T extends Record<K, T[K]> ? never : K }[keyof T], undefined > > export type PartialEither<T, K extends keyof any> = { [P in Exclude<keyof FilterOptional<T>, K>]-?: T[P] } & { [P in Exclude<keyof FilterNotOptional<T>, K>]?: T[P] } & { [P in Extract<keyof T, K>]?: undefined } export type Objects = { [name: string]: any } export type EitherOr<O extends Objects, L extends string, R extends string> = ( | PartialEither<Pick<O, L | R>, L> | PartialEither<Pick<O, L | R>, R> ) & Omit<O, L | R> ```
Pre:
TS常见问题
Next:
react中常用的ts类型大全
0
likes
18
Weibo
Wechat
Tencent Weibo
QQ Zone
RenRen
Submit
Sign in
to leave a comment.
No Leanote account?
Sign up now.
0
comments
More...
Table of content
No Leanote account? Sign up now.