@types/eslint Error: ChainExpression and ImportExpression members of ESTree not exported
Asked Answered
U

7

22

I am having some troubles after executing my angular application with npm start, 'ChainExpression' & 'ImportExpression'members of ESTree interface are not exported causing errors...

Please check image below:

enter image description here

I am using Angular 12 and next node dependencies in my package.json, please see below:

{
...
"@types/node": "12.11.1",
"eslint": "7.10.0",
"ts-node": "8.3.0",
"tslib": "2.2.0",
"tslint": "6.1.0",
"typescript": "4.2.4",
...
}

Do you have any idea about this problem? I will appreciate any kind of help.

Ubiquitarian answered 2/6, 2021 at 14:20 Comment(1)
Did you manage to solve this?Edlyn
H
26

I had the same problem and could see there was a problem with my node modules @types: eslint was referring to ChainExpression and ImportExpression which were missing from estree. compared these with a new angular12 project and then fixed by updating my estree like so:

npm install @types/[email protected] 
Highflier answered 22/7, 2021 at 8:49 Comment(5)
Thanx! This helped me (with latest version though (0.0.50))Hankins
I was having a similar issue where a depenency of ng-packagr was using @types/[email protected] and for whatever reason, this causing issues when trying to use ng serveSportsman
Also had the same issue using ng-packagr. This fixed it. Thanks!Monomolecular
Also had the same issue using @storybook/addon-docs. Thanks!Misconstruction
Thanx! helped to fix same problem in nestjs project. Fixed.Vote
K
13

I had the same problem running typedoc.

This fixed it.

npm install @types/estree@latest
Killingsworth answered 12/9, 2022 at 19:21 Comment(0)
H
9

I had the same problem. led me to adding "typeRoots": ["node_modules/@types"] to tsconfig.json which solved it.

$ node -v
v16.13.0

$ npm -v
8.5.1

$ yarn -v
1.22.5
Heffron answered 24/2, 2022 at 14:2 Comment(5)
Thanx! helped to fix same problemLatour
the default seems better in my case, typescriptlang.org/tsconfig#typeRoots I had the below problem, NX used @types/[email protected]Goldplate
The only thing that worked for me. (Node v12.22.0)Deguzman
Thanks, this has solved my issue and should be marked as answer instead of adding a new dependency in the project.Sporophore
this answer that worked for me (Node v14.21.3); the others that suggested installing @types/estree didn't.Cremate
V
4

I am working on angular migration. I'm migrated my project from angular 11 to angular 12. while building the project I started getting following error

StaticBlock?: ((node: ESTree.StaticBlock & NodeParentExtension) => void) | undefined;

As suggested above I downgraded to @types/[email protected]. I started getting more errors.

PropertyDefinition?: ((node: ESTree.PropertyDefinition & NodeParentExtension) => void) | undefined;

PrivateIdentifier?: ((node: ESTree.PrivateIdentifier & NodeParentExtension) => void) | undefined;

 StaticBlock?: ((node: ESTree.StaticBlock & NodeParentExtension) => void) | undefined;

I digged into definition file realized these properties were not available in @types/estree definition file.

I upgraded estree from 0.0.47 to 1.0.0. This resolved build error.

npm i -D @types/[email protected]
Veinstone answered 17/2, 2023 at 8:52 Comment(1)
Exactly my issue, this worked ! Thanks a lot !It
D
1

Try updating eslint to version 7.27.0, delete package-lock.json, delete node_modules folder and then npm install again.

It seems @types/estree updated 14 hours ago looking here and this could be causing issues.

By the way, if you are using eslint for linting, you can get rid of tslint entry in package.json.

Datha answered 2/6, 2021 at 19:22 Comment(1)
Ok, try creating a new Angular 12 project and try to copy its dependencies as much as possible.Datha
S
0

Somehow @types/eslint is behind. Solution to this problem is:

npm install --save-dev @types/eslint

Then remove package-lock.json and node_modules folder and run install again:

npm install

Errors should be gone now.

Shoshonean answered 19/6, 2021 at 22:55 Comment(0)
B
0

I solved that problem by upgrading angular-eslint-schematics to compatible version for Angular 12 which is "@angular-eslint/schematics": "12.7.0".

I want to write it down here since it does not requires adding new library to project.

Boyla answered 14/6, 2023 at 12:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.