0

enter image description here

I have a typescript project, I use @typescript-eslint/parser and @typescript-eslint/eslint-plugin to lint it.

It seems eslint couldn't recognize undefined in my project. The error message is:

Variable 'undefined' implicitly has an 'any' type.ts(7005)

I have searched on the internet but got nothing.

Have you ever got the same problem?

1
  • I've already found the solution, thanks. Commented Apr 22, 2022 at 9:26

2 Answers 2

1

Could you try to add the line below to tsconfig.ts?:

"noImplicitAny": false
Sign up to request clarification or add additional context in comments.

Comments

0

I found two ways to resolve it:

  1. npm i @types/node --save-dev
  2. "lib": ["esnext", "DOM"] in tsconfig.json

You don't need to do both of them.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.