-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Enable "useUnknownInCatchVariables"
for TypeScript by default
#11826
Comments
Closes #11826 **BREAKING CHANGE** this behaviour was disable when introduced in Deno 1.14/TypeScript 4.4. It will highlight code that unsafely handles variables that are caught, and will cause type errors in unsafe code.
This was reverted. |
@dsherret Should this issue be moved to the Deno 2.0 Milestone? It's currently hanging around on the old 1.16 Milestone. |
Hi @bartlomieju: I see this was closed as completed, but I don't see a linked reference to any related commit or merged PR after the original one was reverted. Can you share a link here for context? Thanks! |
@jsejcksn I closed it with a wrong option :( We actually don't plan to implement it after all due to being a huge breaking change for most users. You are encouraged to enable it on a per-project basis in |
@bartlomieju I see. In that case, please consider re-opening it and closing again as not planned so that it can be indexed with other declined issues. (The same with this one if it's the same scenario.) |
In TypeScript 4.4, the option
"useUnknownInCatchVariables"
was introduced and was default enabled under"strict"
which is the default for Deno. It is a good change, as it helps ensure code properly guards against non-errors being thrown, which if not properly guarded can cause their own runtime errors. The problem is that there is a lot of unsafe code out there, which isn't validating that the value is actually an instance ofError
including quite a lot instd
, so for 1.14 we are doing to disable it, and then enable it for 1.15 to minimise the impact on code.A reminder about our position on breaking changes in TypeScript: https://deno.land/[email protected]/typescript/faqs#there-was-a-breaking-change-in-the-version-of-typescript-that-deno-uses-why-did-you-break-my-program
More on the change in TypeScript: https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-rc/#use-unknown-catch-variables
Ref #11678
The text was updated successfully, but these errors were encountered: