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

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -