我有一个不透明的类型定义,然后有一个类型转换函数来创建该类型的新实例:
export opaque type User: {
email: string,
name?: string | null,
companyName?: string | null,
} = {
email: string,
name?: string | null,
companyName?: string | null,
};
export const newUser = (user: {
email: string,
name?: string | null,
companyName?: string | null,
}): User => user;
:
之前=
之后的类型定义? (否则,我会收到property email missing in User
错误)