hookstate
hookstate copied to clipboard
Bug : Not getting code completion (Types) for setting initial value for the state
Here is the image that shows the issue :

hmm... you are right... Typescript stopped showing type suggestions... I think it is because it can not decide which overload it needs to choose until the value is provided. I have put a workaround for TS like this, would it be acceptable?

This way seems unusual to me... Probably will be confusing to others. Is there no way to have it auto detect based on the generic type we give to hookstate function?
I am not sure. I need to ask Typescript team why VSCode is confused in this case.
This is this issue I believe https://github.com/microsoft/TypeScript/issues/26892. I reproduced it outside of hookstate with just 2 overloads for a function.