You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: content/en/guide/v10/typescript.md
+14-17
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: "Preact has built-in TypeScript support. Learn how to make use of i
5
5
6
6
# TypeScript
7
7
8
-
Preact ships TypeScript type definitions, which are used by the library itself!
8
+
Preact ships TypeScript type definitions, which are used by the library itself!
9
9
10
10
When you use Preact in a TypeScript-aware editor (like VSCode), you can benefit from the added type information while writing regular JavaScript. If you want to add type information to your own applications, you can use [JSDoc annotations](https://fettblog.eu/typescript-jsdoc-superpowers/), or write TypeScript and transpile to regular JavaScript. This section will focus on the latter.
11
11
@@ -233,35 +233,32 @@ Now when we use `Input` it will know about properties like `value`, ...
233
233
Preact emits regular DOM events. As long as your TypeScript project includes the `dom` library (set it in `tsconfig.json`), you have access to all event types that are available in your current configuration.
You can restrict event handlers by adding a type annotation for `this` to the function signature as the first argument. This argument will be erased after transpilation.
253
+
If you prefer inline functions, you can forgo explicitly typing the current event target as it is inferred from the JSX element:
0 commit comments