question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignore Specific Error [AGAIN]

See original GitHub issue

Yes, this is a duplicate of #11051, but that issue is closed and this NEEDS to be addressed.

People use Typescript for more than just Javascript compilation now. There are tons of transpilers that convert TS to all sorts of useful languages. Typescript must have a proper way to disable certain error codes project-wide.

My specific issue right now is that I’m using TypescriptToLua, a Typescript transpiler that produces lua code, and Typescript throws a fit whenever I try to use mathematical operators on classes. This would make sense if I was compiling to Javascript, but I’m not, but I’m forced to annotate every line with @ts-ignore (unrealistic) or suffer through constant reports of TS2362 and TS2363 in my console (infuriating).

There could easily be an ignoreErrors: number[] in the .tsconfig file that provides this functionality. The only thing stopping it from existing is stubborness. Well designed errors that never cause issues are a nice dream, but realistically there will always be use cases that are not met by the error handler, and the user should have the power to suppress invalid warnings.

A short example of my issue:

Typescript that will be converted using TypescriptToLua:

/** @customConstructor vector.new */
declare class Vector {
	constructor(x: number, y?: number, z?: number);
}

const v = new Vector(1, 2, 3);
const vSquared = v * v;

Generated (valid) lua code:

--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
v = vector.new(1, 2, 3)
vSquared = v * v

Obnoxious compiler output:

main.ts:9:18 - error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

9 const vSquared = v * v;
                   ~

main.ts:9:22 - error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

9 const vSquared = v * v;
                       ~

Thank you for your time, I hope that this issue can be seen as what is is, which is a frustrating lack of user control and agency.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:20
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
AncientSwordRagecommented, Apr 11, 2022

I’m using typescript checking of JS files so I can use typescript-style JSDoc types. I don’t need a lot of the other rules checking though. Switching off those rules is really important to me

3reactions
chkpntcommented, Jul 9, 2021

💯! I’m working on a legacy JS project with tons of warnings that can’t simply be fixed. I really like to have the compiler’s hints, but it’s a pity the important ones get lost in the shuffle. The world isn’t black and white, I confirm the need for the ability to opt-out for specific checks. Either by a project wide setting as suggested by @Aurailus or on a file level with something like @ts-nocheck:#1,#2,... (I’d prefer the second option as it allows smaller refactorings when working on the mitigation of a specific issue).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Ignore Specific Errors in Exception Handling | JSCAPE
Learn how to set an exception handling trigger to ignore a specific type of error. This step-by-step guide includes a video tutorial and ......
Read more >
How to ignore specific error in PowerShell when executing a ...
I can suppress those commands error output with -ErrorAction or 2> $null , but I have a bad feeling about completely vanishing any...
Read more >
Is it possible to ignore specific error instance - SonarQube
I'd like to know - in case we don't want to fix some of these - is it possible to somehow mark them...
Read more >
Ignoring TypeScript Errors // Unleashing - YouTube
For a long time the approach with #TypeScript errors was, "you get what you get and you don't get upset". Fortunately we now...
Read more >
Ignoring Errors - Ruby Honeybadger Documentation
To ignore additional errors, use the exceptions.ignore configuration option. The gem will ignore any exceptions matching the string, regex or class that you ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found