You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you do not mention the authors the issue will be ignored.
I cannot call setState with an object being created from computed property name with type-safety:
typeState={username: string,password: string};typeStateKeys=keyofState;classAextendsReact.Component<{},State>{dynSetState(key: StateKeys,value: string){this.setState({[key]: value// Error here. Pretty sure key is in StateKeys});}}
I do aware of #18365, and the workaround in #18365 (comment) . However, when using the workaround, Typescript doesn't error out when it should:
dynLooselySetState(key: string,value: string){this.setState(prevState=>({
...prevState,[key]: value// No error here, but can't ensure that key is in StateKeys}));}
If you know how to fix the issue, make a pull request instead.
@types/reactpackage and had problems.Definitions by:inindex.d.ts) so they can respond.If you do not mention the authors the issue will be ignored.
I cannot call
setStatewith an object being created from computed property name with type-safety:I do aware of #18365, and the workaround in #18365 (comment) . However, when using the workaround, Typescript doesn't error out when it should: