Open jstewmon opened 3 years ago
When the target is ES5, typescript emits class inheritance code that is incompatible with instanceof checks in some cases.
A consequence of targeting ES5 is that library consumers cannot use instanceof type narrowing on errors thrown by the library:
instanceof
try { const res = await gigya.accounts.getAccountInfo({UID}); } catch (err) { if (err instanceof GigyaError) { // unreachable when target is ES5 } }
Bumping the target to ES2015 resolves this issue.
When the target is ES5, typescript emits class inheritance code that is incompatible with instanceof checks in some cases.
A consequence of targeting ES5 is that library consumers cannot use
instanceof
type narrowing on errors thrown by the library:Bumping the target to ES2015 resolves this issue.