tslib icon indicating copy to clipboard operation
tslib copied to clipboard

v1.13.0 Error with older typescript version -- node_modules/tslib/tslib.d.ts(37,78): error TS2304: Cannot find name 'PropertyKey'. (When targeting es3)

Open MSNev opened this issue 5 years ago • 3 comments

Hi,

We are from the ApplicationInsights team and on updating the npm package to 1.13.0 we are now getting this error. We are currently using ts v2.5.3 and as of today we cannot update to a later version because of issues with teams that consume our generated code.

Compiling... Using tsc v2.5.3 common/temp/node_modules/tslib/tslib.d.ts(37,78): error TS2304: Cannot find name 'PropertyKey'. common/temp/node_modules/tslib/tslib.d.ts(37,103): error TS2304: Cannot find name 'PropertyKey'.

MSNev avatar May 18 '20 20:05 MSNev

The issue is that for backward compatibility we are targeting "es3" to ensure that we don't introduce breaking changes that cause consumers of the App Insights SDK which happen to load in an ES3 environment to completely fail.

MSNev avatar May 27 '20 05:05 MSNev

We have temporarily worked around this by creating our own "applicationinsights-shims" module which provides the needed __assign() and __extends() implementations, however, this requires our consumers to also include this module or if using webpack to use the ProviderPlug() to inject the implementations from tslib or the shims module.

We would however, like to get back of the train rather than keeping our workaround and it's constraints

MSNev avatar Jul 02 '20 20:07 MSNev

@MSNev Note that I think "es3" users could set "skipLibCheck": true (this value is the default when using tsc --init) in their tsconfig.json to make it work.

nicolashenry avatar Sep 03 '20 17:09 nicolashenry