scotthovestadt / gigya

Gigya JavaScript REST SDK
MIT License
37 stars 62 forks source link

chore: bump typescript target to ES2015 #55

Open jstewmon opened 3 years ago

jstewmon commented 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:

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.