drabinowitz
Joined 11 years ago
Karma
138
Submissions
15
Member since
Jan 16
Joined 11 years ago
const maybePets: Array<Pet | undefined> = [...]
const pets: Array<Pet> = maybePets.filter((v: Pet | undefined): v is Pet => v != undefined)
Will compile without errors. function MyReactComponent() {
const [
[width, setWidth],
[name, setName],
] = React.use(
[useWidth],
[useName, 'alice'],
);
return <div>{width} {name}</div>
}
admittedly, this is much less clean looking than the current proposal, but, in my mind at least, it makes it a bit more clear that you have to pass the functions in with a specific order at the top of the component.