We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
type Person = { name: string; age: number; } // 使用Partial将 Person 中所有的参数变为可选 type PartialPerson = Partial<Person>; type PartialPerson = { name?: string | undefined; age?: number | undefined; }
The text was updated successfully, but these errors were encountered:
type MyPartial<T> = { [K in keyof T]?:T[K] } // 遍历 T 类型的所有键, 加上可选修饰符 `?`, 值为原来的类型
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: