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
typeErr={status: 'Err',msg: string,}typeOk={status: 'Ok',data: number,}typeResult=Err|Okconstresult: Result=JSON.parse('{"status": "Ok", "data": 5}')// this worksif(result.status==='Ok'){console.log(result.data*2)}// But this doesn't work!conststatus=result.statusif(status==='Ok'){console.log(result.data*2)}
The text was updated successfully, but these errors were encountered:
An example speaks louder than words:
The text was updated successfully, but these errors were encountered: