Skip to content

Commit fe362f4

Browse files
docs: Fix messy TypeScript error handling explanation (#2788)
Co-authored-by: Jo Franchetti <jofranchetti@gmail.com>
1 parent f2d6e80 commit fe362f4

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

examples/videos/configuration_with_deno_json.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,22 @@ import { sing } from "jsr:@eveporcello/sing";
152152
console.log(sing("sun", 3));
153153
```
154154

155-
This is a rule that’s going to, if I add this to the top of any file, the
156-
intended behavior in a project, it’s going to make sure that Typescript just
157-
ignores any of the types that are in this file, so it doesn’t matter if it
158-
adheres to the rules. But, if I run
155+
What this rule does is prevent you from silencing TypeScript errors by dropping
156+
a // @ts-ignore or similar comment at the top of a file. In other words, you
157+
can’t just tell TypeScript to ignore type checking in a file without explicitly
158+
justifying it. That’s the intended behavior: if you’re bypassing the type
159+
system, you should have to explain why.
160+
161+
However, when you run
159162

160163
```sh
161164
deno task format
162165
```
163166

164-
again, this is going to tell me, “Hey, you can’t do that. You can’t ignore these
165-
files without comment.” This is one of those rules. But, we know where to find a
166-
way out of that trap, which, maybe you don’t want to find a way out, but I’ll
167-
show you how anyway. We’ll say `”exclude”: [“ban-ts-comment”]`.
167+
Deno will enforce this rule and complain if it finds ignored TypeScript checks
168+
without an accompanying comment. If you really do want to allow this behavior
169+
anyway, you can opt out of the rule entirely by disabling it in your
170+
configuration. We’ll say `”exclude”: [“ban-ts-comment”]`.
168171

169172
```json title="deno.json"
170173
{

0 commit comments

Comments
 (0)