|
|
|
|
|
by meetups323
1941 days ago
|
|
In TS this would be flipped: type Person = {
name: string;
age: number;
}
type SomeFieldsMissing = Partial<Person>;
type AllFieldsRequired = Required<Person>; // No real change in this case
Where Partial and Required are defined like: type Partial<T> = { [P in keyof T]?: T[P] | undefined; }
type Required<T> = { [P in keyof T]-?: T[P]; }
What would you think of something like this ("mapped types")? They can get fairly powerful: https://www.typescriptlang.org/docs/handbook/2/mapped-types.... |
|