update typescript check command

so that it doesn't complain about undefined web apis
master
Simon Laux 2022-01-17 23:57:53 +01:00 committed by B. Petersen
parent 19f628ec50
commit 3f64ef1424
No known key found for this signature in database
GPG Key ID: 3B88E92DEA8E9AFC
1 changed files with 5 additions and 4 deletions

View File

@ -22,20 +22,21 @@ and send it to your friends :)
note, that the api is not yet complete,
this is just a, maybe already useful, proof-of-concept for now.
## use type-checking and completion
If you are using vscode you can have autocompletion and type-checking even without using typescript.
just add these two lines to your javascript source files:
```js
//@ts-check
/** @typedef {import('./webxdc').WEBxDC} WEBxDC */
```
Without vscode you need to install typescript and then run the check manually.
```sh
npm -g typescript
tsc --noEmit --allowJs webxdc.js # to check if types and simulator are in sync
tsc --noEmit --allowJs your_js_file.js
```
tsc --noEmit --allowJs --lib es2015,dom webxdc.js # to check if types and simulator are in sync
tsc --noEmit --allowJs --lib es2015,dom your_js_file.js
```