mirror of
https://gitee.com/vuejs/vue.git
synced 2024-11-29 18:47:39 +08:00
16 lines
531 B
TypeScript
16 lines
531 B
TypeScript
|
export type Data = { [key: string]: unknown }
|
||
|
|
||
|
export type UnionToIntersection<U> = (
|
||
|
U extends any ? (k: U) => void : never
|
||
|
) extends (k: infer I) => void
|
||
|
? I
|
||
|
: never
|
||
|
|
||
|
// Conditional returns can enforce identical types.
|
||
|
// See here: https://github.com/Microsoft/TypeScript/issues/27024#issuecomment-421529650
|
||
|
// prettier-ignore
|
||
|
type Equal<Left, Right> =
|
||
|
(<U>() => U extends Left ? 1 : 0) extends (<U>() => U extends Right ? 1 : 0) ? true : false;
|
||
|
|
||
|
export type HasDefined<T> = Equal<T, unknown> extends true ? false : true
|