npmtypescript95% confidence\u2191 145

How to ignore TypeScript errors with @ts-ignore?

Full error message
I have a case where I'm importing a pure JavaScript library within a TypeScript project and it is giving me the error Could not find a declaration file for module xxx.

After reading I found I can suppress that with a comment @ts-ignore. Yet upon adding that comment before the offending line I get another error:

Do not use "// @ts-ignore" comments because they suppress compilation errors  @typescript-eslint/ban-ts-ignore

How can I fix this error and suppress the original message?

You can stop using @ts-ignore Or you can disable the eslint rule. Add that in your eslint config (.eslintrc or equivalent) ... "rules": { "@typescript-eslint/ban-ts-ignore": "off" } ... EDIT: If you are using @typescript-eslint/eslint-plugin version 2.18 or higher, the rule is called ban-ts-comment and you need to add "@typescript-eslint/ban-ts-comment": "off" instead. Here is the changelog

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/4f6c144d8e98aa1293a7e4f6ae8533f680a16ac7cc6dce86d2f29529dea440bc
hash \u00b7 4f6c144d8e98aa1293a7e4f6ae8533f680a16ac7cc6dce86d2f29529dea440bc
How to ignore TypeScript errors with @ts-ignore? — DepScope fix | DepScope