Skip to content

Commit 3af32a8

Browse files
committed
improve ts guides
1 parent 236c758 commit 3af32a8

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

apps/site/pages/en/learn/typescript/introduction.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ These type definitions allow TypeScript to understand Node.js APIs and provide p
7373
```js
7474
import * as fs from 'fs';
7575

76-
fs.readFile('example.txt', 'foo', (err, data) => {
77-
// ^^^ Argument of type '"foo"' is not assignable to parameter of type …
76+
fs.readFile('example.txt', foo, (err, data) => {
77+
// ^^^
78+
// Argument of type '"foo"' is not assignable to parameter of type …
7879
if (err) {
7980
throw err;
8081
}

apps/site/pages/en/learn/typescript/publishing-a-ts-package.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ A note about directory organisation: There are a few common practices for placin
126126
The purpose of types is to warn an implementation will not work:
127127

128128
```ts
129+
// @errors: 2322
129130
const foo = 'a';
130131
const bar: number = 1 + foo;
131-
// ^^^ Type 'string' is not assignable to type 'number'.
132132
```
133133

134134
TypeScript has warned that the above code will not behave as intended, just like a unit test warns that code does not behave as intended. They are complementary and verify different things—you should have both.

packages/rehype-shiki/src/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const { shiki, getLanguageDisplayName, highlightToHast, highlightToHtml } =
2424
transformerTwoslash({
2525
langs: ['ts', 'js', 'cjs', 'mjs'],
2626
// Don't throw on errors on untype-able code
27-
// throws: false,
27+
throws: false,
2828
}),
2929
],
3030
// We use the faster WASM engine on the server instead of the web-optimized version.

0 commit comments

Comments
 (0)