-
Notifications
You must be signed in to change notification settings - Fork 12.8k
AllowJs + ES6 lib result in compiler crash #40251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That is because https://unpkg.com/browse/@okta/okta-signin-widget@4.3.3/dist/js/okta-sign-in.js is not a JS Module its a webpack module TS does not support importing webpack modules at present. |
The same module works in version 3.9 of Typescript. If you change the TS version in that package ☝️ to |
The root issue is that this produces an error: declare let s: (...items: never[]) => never[];
let t: () => unknown[] = s; // Error, but should be ok To make matters worse, when attempting to report the erroneous error, we crash if there's a rest parameter: declare let s: (...items: never[]) => never[];
let t: (...args: []) => unknown[] = s; // Crash The issue only occurs with a rest parameter of type |
TypeScript Version: 4.0.2
Search Terms:
typescript Cannot read property 'name' of undefined
Code
For reasons beyond my control, my team has a few node modules checked into our code that we subsequently run through the Typescript compiler as a part of building our front end through the
ts-loader
Webpack loader. We can probably work around this on our end because this case is special, but I'm reporting this because I have a hunch that there could be other legitimate cases that fall to the same error. Here's a minimalpackage.json
andtsconfig.json
that I can use to recreate the problem:Just
npm i && npm run build
and you'll see the errorExpected behavior:
The compiler finishes without failure
Actual behavior:
An error gets thrown:
The text was updated successfully, but these errors were encountered: