Mapped Types


Mapped types allow you to create a new type by transforming properties of an existing type.

type PointUpdate = {
    [P in keyof Point]?: Point[P];
};

Exercise

Create a mapped type NullablePoint where each property of the Point type is made nullable (i.e., it can also be null).


Copyright © learn-ts.org. Read our Terms of Use and Privacy Policy