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: packages/lit-dev-content/site/docs/v3/tools/development.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -202,12 +202,23 @@ For full installation and usage instructions, see the [Web Dev Server documentat
202
202
203
203
## TypeScript { #typescript }
204
204
205
-
TypeScript extends the Javascript language by adding support for types. Types are useful for catching errors early and making code more readable and understandable.
205
+
Lit support developing components in TypeScript, including full type declarations for the Lit APIs, standard and experimental decorators, and community tools for template type-checking and linting.
206
+
207
+
Because Lit is just a library, and doesn't require a compiler or use non-standard langauge syntax, there are no specific TypeScript tools that are required. Lit works with the official TypeScript compiler, `tsc`, with TypeScript wrappers such as those for Rollup, Vite, or Webpack, and alternate compilers like `esbuild`.
208
+
209
+
The main requirements of a TypeScript project are:
210
+
- Enabling a modern JavaScript language level, like with the `"ES2021"`[lib](https://www.typescriptlang.org/tsconfig/#lib).
211
+
- Enabling the DOM types with the `"DOM"`[lib](https://www.typescriptlang.org/tsconfig/#lib).
212
+
- Optionally [enabling experimental decorators](https://www.typescriptlang.org/tsconfig/#experimentalDecorators) and [disabling "define" semantics for class fields](https://www.typescriptlang.org/tsconfig/#useDefineForClassFields), if you choose to use TypeScript's experimental decorators.
213
+
214
+
These options are generally set in your project's tsconfig.
215
+
216
+
### Installation
206
217
207
218
To install TypeScript in your project:
208
219
209
220
```bash
210
-
npm install typescript --save-dev
221
+
npm i -D typescript
211
222
```
212
223
213
224
To build the code:
@@ -218,6 +229,10 @@ npx tsc --watch
218
229
219
230
For full installation and usage instructions, see the [TypeScript site](https://www.typescriptlang.org/). To get started, the sections on [installing TypeScript](https://www.typescriptlang.org/docs/handbook/typescript-tooling-in-5-minutes.html) and [using its features](https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html) are particularly helpful.
220
231
232
+
### Decorators
233
+
234
+
TypeScript supports two versions of decorators: experimental and standard. See our [Decorators](/docs/v3/components/decorators/#decorators-typescript) documentation for more information.
235
+
221
236
## JavaScript and TypeScript linting { #linting }
222
237
223
238
Linting can help catch errors in your code. We recommend using [ESLint](https://eslint.org) for linting Lit code.
0 commit comments