I am writing Javascript in Visual Studio Code (not Typescript). However, I added "checkJs": true ("Enable type checking on JavaScript files") to my compilerOptions in jsconfig.json to enable automatic imports.
Now that I have done that, I'm getting Typescript errors (squiggly lines), for instance:
JSX element type 'Foo' does not have any construct or call signatures. ts(2604)
I could remove these by disabling validity checking, but then I'd lose normal Javascript validity checking.
My question is: is it possible to have automatic imports, and Javascript validity checking, but not have Typescript errors in VS Code? For instance, is there some flag I can set in jsconfig.json to disable errors with "ts" at the end?
And if not, how do I fix Typescript errors in a Javascript file ... without having to adopt Typescript?
EDIT: Just to help clarify the kind of solution I'm imagining ... let's say we were talking about ESLint here. Yes I could add a comment at the top of a file to make ESLint ignore that file, but then I lose all linting whatsoever.
I'm more looking for the equivalent of being able to say "ts2604": false or "ts*": false in an .eslintrc file, or something more like that. In other words, I don't want to adopt Typescript, or lose all type awareness either ... I just want VS Code's great Javascript features, without large chunks of my code being underlined by error/warning messages that I can't do anything about.
jsconfig.js: I've never had atsconfig.json, because I've never done Typescript. The only way TypeScript is related is that using it in some sense, via thecheckJscompiler option, is somehow necessary to get automatic imports. But just because I want VS Code to use Typescript to infer some types when importing, that doesn't mean I care about some code lacking a type in my Javascript code ... which is why I'm looking for some sort of compromise.jsconfig.js(includingcheckJs: true) into atsconfig.js: it did nothing.checkJsoption injsconfig.jsI'm using. However that mechanism , and the others listed (eg.// @ts-check) seem to be an all or nothing deal: you get all the features and the TS warnings, or none. I'm trying to get the features, but somehow disable/hide/ignore the Typescript warnings about not having types for things in my JS files (because my jS files have no type definitions). Even just a way to "turn off" certain warnings/errors by code (eg. don't show mets(2604)errors) would be helpful.