Closed
Description
opened on Nov 16, 2016
Recently introduces keyof
operator will work well for typing functions that accept properties directly on target type.
interface Some {
a: number,
b: string
}
type oneOfTheSomeKeys = keyof Some // restricts value to "a", "b"
What do you think, is it possible in theory to type deeply nested paths, so that for type:
interface Some {
a: number,
b: {
c: number
d: {
e: number
}
}
}
so that it would be possible to restrict possible path values to:
["a"]
["b"]
["b", "c"]
["b", "d"]
["b", "d, "e"]
This actual for such methods like ramda's path
:
R.path(['a', 'b'], {a: {b: 2}}); //=> 2
R.path(['a', 'b'], {c: {b: 2}}); //=> undefined
?
Activity