flowtype - Flow: Subset of properties for object type -
when defining object type, there way derive type subset of properties? instance, given type:
type user = { id: number, name: string }; i'd write like:
$subset<user, ["id"]> which equivalent to:
{id: number} the best come using $propertytype:
{id: $propertytype<user, "id">} although doesn't guarantee consistent property names.
Comments
Post a Comment