Search code examples
typescripttsc

Mute/ignore TS2307 error from TypeScript tsc


Is there a way to mute the TS2307 error from the TypeScript tsc compiler?

It makes it really hard to spot real/new errors and warnings as there are many TS2307 errors in our codebase.

Update:

This error occurs when an external module is imported without its type definition .d.ts being present.

I'm aware of tsd but for many libraries we use, no type definitions exist.


Solution

  • UPDATE

    This is possible in newer version of TypeScript. See answer from stsloth.

    ORIGINAL ANSWER

    No, there is not a way to direct the compiler to suppress TS2307. There has been some discussion about it for exactly the reason you describe. For large projects, this becomes a huge barrier to entry.

    Details here: Making JavaScript to TypeScript migration easier : Suppress errors

    And here: Find a way to suppress the errors generated by importing modules

    What you might be able to do is add a step to your build process that filters the error messages. That, of course, depends on how you are doing your builds.