2018-07-03

Dealing with implicit any in node_modules

I like to set noImplicitAny in my TypeScript projects in the hopes it will catch just a few more bugs before they hit production. Problem we had recently was that not every library author agrees with me. In this case the aws-amplify project gave us this error.

node_modules/aws-amplify/lib/Interactions/Interactions.d.ts
(19,44): Parameter 'err' implicitly has an 'any' type.

Well that sucks, they should use noImplicitAny! From our perspective we can fix this by not applying our implicit any rules to library definition files. This can be done by adding

"skipLibCheck": true

To the compilerOptions in our tsconfig.json so that errors in the definition files there were ignored.


comment: