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
// case 1functioninsertInterface(callbackType: InterfaceType){for(constmemberTypeofcallbackType.members){if(memberType.type==="const"){memberType.idlType// type of idlType: string, no error}elseif(memberType.type==="operation"){memberType.idlType.origin;// type of idlType: IDLTypeDescription at least on mouse hover/* Mutually incompatible messages appear simultaneously: 1. (property) IDLTypeDescription.origin: string 2. Property 'origin' does not exist on type 'string' */(memberType.idlTypeasIDLTypeDescription);// Error: Type 'string' cannot be converted to type 'IDLTypeDescription'}}}
// case 2functioninsertInterface2(callbackType: InterfaceType){for(constmemberTypeofcallbackType.members){if(memberType.type==="operation"){memberType.idlType.origin// type of idlType: IDLTypeDescription// type of origin: string, no error}}}
// case 3functionfoo(memberType: IDLMemberTypes){if(memberType.type==="const"){memberType.idlType// type of idlType: string, no error}elseif(memberType.type==="operation"){memberType.idlType.origin// type of idlType: IDLTypeDescription// type of origin: string, no error}}
Expected behavior:
memberType.idlType.origin should be string in both case thanks to the type guard
Actual behavior:
Type guard confuses the type of idlType
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.0 beta
Code
Expected behavior:
memberType.idlType.origin
should be string in both case thanks to the type guardActual behavior:
Type guard confuses the type of idlType
The text was updated successfully, but these errors were encountered: