www.executeprogram.com/courses/everyday-typescript/lessons/partial
1 Users
0 Comments
11 Highlights
0 Notes
Tags
Top Highlights
look at the type definition for Partial itself.
Partial<User> is exactly the same type as {name?: string, postalCode?: string}
not a good solutio
These are objects with some of an object type's properties, but not necessarily all of them.
manually with the ?
?:
Partial<T> means "an object that has the same properties as T, but each property is optional"
postalCode property above is a string | undefined
node_modules/typescript/lib/lib.es5.d.ts
[P in keyof T]?: T[P]
we could write Partial ourselves
Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.