@turbowarp/types 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -10
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Types definitions for the Scratch VM and editor
|
|
2
2
|
|
|
3
|
-
Scratch doesn't provide
|
|
3
|
+
Scratch doesn't provide type definitions for their libraries, so we wrote our own.
|
|
4
4
|
|
|
5
5
|
This project is still at an early stage.
|
|
6
6
|
|
|
7
|
-
Despite being in the TurboWarp organization, this project is currently focused only on the vanilla
|
|
7
|
+
Despite being in the TurboWarp organization, this project is currently focused only on the vanilla (LLK) Scratch runtime and editor. Additional types for TurboWarp may be added later.
|
|
8
8
|
|
|
9
9
|
|Module|Status|
|
|
10
10
|
|:-:|:-:|
|
|
@@ -22,17 +22,23 @@ Despite being in the TurboWarp organization, this project is currently focused o
|
|
|
22
22
|
|
|
23
23
|
## Using from npm
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
First, install the types:
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
```
|
|
28
|
+
npm install @turbowarp/types
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Next, you must use `tsconfig.json` to configure TypeScript to know how to find the types.
|
|
28
32
|
|
|
29
33
|
```json5
|
|
30
34
|
{
|
|
31
35
|
"compilerOptions": {
|
|
36
|
+
// If you use require() or "module": "CommonJS", remove these lines.
|
|
37
|
+
// If you use "module": "ES6", synthetic default imports are required.
|
|
32
38
|
"module": "ES6",
|
|
33
39
|
"allowSyntheticDefaultImports": true,
|
|
34
40
|
|
|
35
|
-
// Tell TypeScript where to find the types for Scratch libraries
|
|
41
|
+
// Tell TypeScript where to find the types for Scratch libraries.
|
|
36
42
|
"paths": {
|
|
37
43
|
"scratch-vm": ["./node_modules/@turbowarp/types/index.d.ts"],
|
|
38
44
|
"scratch-render": ["./node_modules/@turbowarp/types/index.d.ts"],
|
|
@@ -44,7 +50,7 @@ You can tell TypeScript to use these types when you import scratch-vm, scratch-r
|
|
|
44
50
|
"scratch-blocks": ["./node_modules/@turbowarp/types/index.d.ts"]
|
|
45
51
|
},
|
|
46
52
|
|
|
47
|
-
// Recommended strictness settings
|
|
53
|
+
// Recommended strictness settings. Change as you please.
|
|
48
54
|
"strictNullChecks": true,
|
|
49
55
|
"noImplicitAny": true,
|
|
50
56
|
"noImplicitThis": true
|
|
@@ -64,7 +70,7 @@ vm.loadProject(/* read a project somehow */ new ArrayBuffer(100))
|
|
|
64
70
|
});
|
|
65
71
|
```
|
|
66
72
|
|
|
67
|
-
Or if you
|
|
73
|
+
Or if you still use require():
|
|
68
74
|
|
|
69
75
|
```js
|
|
70
76
|
const VM = require('scratch-vm');
|
|
@@ -78,10 +84,10 @@ vm.loadProject(/* read a project somehow */ new ArrayBuffer(100))
|
|
|
78
84
|
|
|
79
85
|
## Tests
|
|
80
86
|
|
|
81
|
-
There are some tests in the tests folder. These files are never actually run, but the code will be type checked.
|
|
87
|
+
There are some tests in the `tests` folder. These files are never actually run, but the code will be type checked.
|
|
82
88
|
|
|
83
89
|
## License
|
|
84
90
|
|
|
85
|
-
Type definitions are licensed under the Apache 2.0 license.
|
|
91
|
+
Type definitions and test code are licensed under the Apache 2.0 license.
|
|
86
92
|
|
|
87
|
-
The
|
|
93
|
+
The libraries being documented may be under different licenses.
|
package/package.json
CHANGED