-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
checkJs + suppressing errors = powerful #15430
Comments
both options are enabled. please see https://github.com/Microsoft/TypeScript/wiki/Type-Checking-JavaScript-Files for more details. |
// @ts-nocheck is not enough. |
We do not believe switching off specific errors across the whole project is a good idea. think of today you have two modes, You can list the files you want to check in your |
We have 4 legacy .net web applications. One "small" application for example has 290 js files and we have > 20,000 typescript errors. Note that the all JS files are valid, but we not able to compile a solution. We not able doing "soft" migration. For example in our legacy application for the first stage we must suppress following errors : TS2304, TS2384, TS2393, TS2339, TS2365, TS2346, TS2322, TS2403, TS2345, TS7027, TS2362, TS1313, TS2300, TS2350, TS2453, TS2363, TS2349, TS2540, TS2447, TS2678. I know it's not ideal, but for the first stage this is a solution. That will allows us to compile solution without any error. We will remove errors from this list, but that can take a time. P.S. Sorry for my bad english |
I do not think switching off error codes is a good idea. it might work for local errors (like what a linter would do), but not for type system errors. I can see a more config-bases solution to exclude some files listed by a glob patter for instance, |
@ifle @mhegazy I think comment-based inline suppressing is better like ESLint. /* typescript-disable */
const foo: string = 1;
/* typescript-enable */ or // typescript-disable-next-line
const foo: string = 1; also specifying the error code /* typescript-disable TS2322 */
const foo: string = 1;
/* typescript-enable */
// typescript-disable-next-line TS2322
const foo: string = 1; Closure Compiler has two options, 1: global setting by command line option, 2: /** @suppress {checkTypes} */
const foo: string = 1; ref: #4094 |
@teppeis I totally agree that both options (global and comment) are perfect. |
Did this topic die off? |
@mhegazy Maybe a bit broad of an issue, but the ability to disable warnings that require a lot of gymnastic workarounds/comment noise/ignoring files for code that can't be changed yet would be extremely valuable. A good example of this is having to add type JSDoc annotations to any object that needs to be a |
TypeScript Version: 2.3Code
Both these options will be very powerful
The text was updated successfully, but these errors were encountered: