Home > Net >  TypeScript: tsconfig allow anything
TypeScript: tsconfig allow anything

Time:07-24

You read that right. I want TypeScript to allow ANYTHING. I have to use a library that's causing all sorts of ts errors when I compile the code that I can't seem to fix no matter what I've tried. I've been going through SO questions like these:

TypeScript skipLibCheck still checking node_modules libs

Could not find a declaration file for module 'module-name'. '/path/to/module-name.js' implicitly has an 'any' type

I have found a glimmer of hope. adding "noImplicitAny": false to my tsconfig.json's compilerOptions did get rid of the implicit any bugs. So now I'm wondering if there's a TS settings that will just allow anything. I know this is bad practice, but I just want my bundler to stop complaining and transpile my code. I don't care if I have a TypeScript file that passes a number to a function that only accept strings!

CodePudding user response:

Which npm Library are you using? often they come with built in type support.

For example @types/node(installed using npm install @types/node)... so npm install @types/packageName)

CodePudding user response:

Configuring TSConfig for type-checking

Disable the strict mode and all other relevant type-checking modes mentioned here in the docs. That should solve most of your problems, if that doesn't,

Explicitly declaring Any

You can go on to assign any explicitly like this

let var: any = "string";
  • Related