-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tsconfig.json option to ignore error TS2307 (or any specific error) #59429
Comments
Why not just tell TypeScript that these are valid module imports, instead of hiding the error? Create a It's better to work with the tools instead of against them. The problem especially with ignoring "any specific error" is that these errors still happen, and can still cause the parsing of the code to trip. |
Add declare module "indico-url:*.static" {
export const staticURL: string;
export default staticURL;
} to a declaration file, this will tell typescript that any module of the form |
|
@jcalz That issue is about being able to distinguish between errors when using |
Thanks everyone, that seems to work. I had no idea you could use wildcards in module names. I'll close the issue. |
π Search Terms
β Viability Checklist
β Suggestion
In our project we're using some convenience babel magic to add "virtual" packages which inject data into the client application. E.g.
(fetches a URL from the backend's blueprint map)
This is obviously not appreciated by TypeScript, although it's not an issue in the end because we transpile it using Babel. On the other hand, VS Code does complain about it because TS does. Having the VS Code integration is useful and we'd like to continue using it and mute this particular error.
Right now the only option we have is to do something like:
... which is not great, especially if you end up in a file which has several of those.
Hence, it would be very useful if we could have an option to mute a particular error, or at least something which lets us tell Typescript that we don't want to see errors about unresolved modules (we get those from ESLint anyway).
I found this old discussion, from which there was no conclusion. Maybe there's something new?
π Motivating Example
"You're now able to silence particular errors, which is especially useful if you are already using a dedicated linting tool such as ESLint and want to have full control over which errors you see."
π» Use Cases
// @ts-expect-error
, which is far from ideal.The text was updated successfully, but these errors were encountered: