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
Type narrowing is not working (not supported?) for fields (VS2013, TypeScript 1.4).
classO1Cls{x: any;}classO2Cls{y: any;}interfaceOptions{opt: O1Cls|O2Cls;}classMyClass{constructor(options: Options){if(options.optinstanceofO1Cls){console.log(options.opt.x);// Error: Property 'x' does not exists on type 'O1Cls | O2Cls'}varopt=options.opt;if(optinstanceofO1Cls){console.log(opt.x);// OK}}}
Will it be supported or is this a "by design" behaviour?
The text was updated successfully, but these errors were encountered:
Hi!
Type narrowing is not working (not supported?) for fields (VS2013, TypeScript 1.4).
Will it be supported or is this a "by design" behaviour?
The text was updated successfully, but these errors were encountered: