Closed
Description
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 minimal package.json
and tsconfig.json
that 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 build
and you'll see the error
Expected behavior:
The compiler finishes without failure
Actual behavior:
An error gets thrown:
TypeError: Cannot read property 'name' of undefined