Repository navigation
AllowJs + ES6 lib result in compiler crash #40251
Description
Activity
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.
Reacted by ExE BossThe same module works in version 3.9 of Typescript. If you change the TS version in that package ☝️ to
3.9.7and runnpm i && npm build, there are no errors and a file is emitted to the correct directory. Are you saying that this was an undocumented breaking change of version 4?- addedRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestoneand removedRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
on Aug 31, 2020 - added a commit that references this issue
on Oct 27, 2020 - addedFix AvailableA PR has been opened for this issueA PR has been opened for this issue
on Oct 27, 2020 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
never[]and it's caused bycompareSignaturesRelatedassuming thatany(the type used for an unmatched parameter position) is assignable to anything. It is--except fornever. We should change the logic to not even attempt to relate unmatched positions. I will put up a PR to that effect.Reacted by bb010g- assigned and unassigned
on Oct 28, 2020 - locked as resolved and limited conversation to collaborators
on Oct 21, 2025
TypeScript Version: 4.0.2
Search Terms:
typescript Cannot read property 'name' of undefinedCode
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-loaderWebpack 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.jsonandtsconfig.jsonthat I can use to recreate the problem:{ "name": "broken-typescript", "version": "1.0.0", "scripts": { "build": "tsc -p tsconfig.json" }, "dependencies": { "@okta/okta-signin-widget": "4.3.3", "typescript": "4.0.2" } }{ "compilerOptions": { "rootDir": "./", "outDir": "out", "allowJs": true, "strict": true, "lib": ["es6"] }, "include": [ "./node_modules/@okta/okta-signin-widget/dist/js/okta-sign-in.js" ] }Just
npm i && npm run buildand you'll see the errorExpected behavior:
The compiler finishes without failure
Actual behavior:
An error gets thrown: