-1

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!

sdfsdf
  • 5,052
  • 9
  • 42
  • 75
  • There's no simple config option to do this, see [ms/TS#29651](https://github.com/microsoft/TypeScript/issues/29651) for the feature request. You could [put `// @ts-nocheck` at the top of each file](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#-ts-nocheck-in-typescript-files), or change your build to pipe the console output of tsc to `/dev/null` since it transpiles even if there are errors. Does any of this constitute an answer for you? If so I can write it up; if not, what am I missing? – jcalz Jul 23 '22 at 19:19
  • "change your build to pipe the console output of tsc to /dev/null". I am using rollup. Idk. The easiest solution would be to set all the `"no"` to `false`? – sdfsdf Jul 23 '22 at 20:09

2 Answers2

0

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";
0

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)

sudo install
  • 148
  • 1
  • 1
  • 7