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
letstrOrArray: Array<string>|string;letstr: string;if(typeofstrOrArray==='string'){// No errorstr=strOrArray;}
But not this:
interfaceData{strOrArray: Array<string>|string;}letdata: Data;letstr: string;if(typeofdata.strOrArray==='string'){// Error:// Type 'string[] | string' is not assignable to type 'string'.// Type 'string[]' is not assignable to type 'string'.str=data.strOrArray;}
Tested with tsc 1.7.5 and Visual Studio Code 0.10.6
The text was updated successfully, but these errors were encountered:
This works:
But not this:
Tested with tsc 1.7.5 and Visual Studio Code 0.10.6
The text was updated successfully, but these errors were encountered: