So this will pass flow check but throw at runtime? type Foo = { baz: () => void } function callBaz(foo: Foo) { // baz exists because types return foo.baz() } const foo: Foo = {} callBaz(foo) > UNDEFINED IS NOT A FUNCTION
-
-
- 5 more replies
New conversation -
-
-
The workaround is to freeze the object. const obj: {foo: string} = Object.freeze({}) Will error.
-
Yeah that’s what I ended up doing, better than: {...null}
End of conversation
New conversation -
-
-
the last thing that surprised me was that `const a: {|foo?: number|} = {}` does error
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
This is unfortunate behavior. Would like to optionally disable this. One workaround is to use a lint rule to prevent `{}` in favor of `{...null}`
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Does specifying pipes in the type error?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Tbh this is something that should be configurable because TS will yell at you in this case but sometimes I just want to add my properties a few lines later.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Is this a design choice? Why?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 







