Skip to content

NullableProps #205

Description

@sheam

Like the 'Optional' utility type, could we have the equivilant which makes fields of the object nullable instead of optional?

For example if I have the type:

interface IPerson {
  name: string;
  age: string;
}

I would like a utility type NullableFields (or whatever name) to transform it into the following:

type NullablePerson = NullableFields<IPerson>;

// resulting type is:
{
  name: string|null;
  age: number|null;
}

// OR type NullableNamePerson = NullableFields<IPerson, 'name'>;

//resulting type is:
{
  name: string|null;
  age: number;
}

Thanks.

Forgive me if this already exists under another name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions