typed-factorio 2.4.1 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +22 -7
- package/package.json +2 -2
- package/prototype/generated/prototypes.d.ts +1721 -1721
- package/prototype/generated/types.d.ts +1418 -1418
- package/runtime/generated/builtin-types.d.ts +12 -12
- package/runtime/generated/classes.d.ts +3309 -3309
- package/runtime/generated/concepts.d.ts +174 -174
- package/runtime/generated/defines.d.ts +120 -120
- package/runtime/generated/events.d.ts +185 -185
- package/runtime/generated/global-functions.d.ts +3 -3
- package/runtime/generated/global-objects.d.ts +6 -6
package/README.md
CHANGED
@@ -41,15 +41,13 @@ import { ItemPrototype } from "factorio:prototype"
|
|
41
41
|
import { LuaEntity } from "factorio:runtime"
|
42
42
|
```
|
43
43
|
|
44
|
-
###
|
44
|
+
### `data.extend()`
|
45
45
|
In the settings and prototype stages, the `data` global variable is available.
|
46
46
|
|
47
|
-
For [performance reasons](https://github.com/microsoft/TypeScript/wiki/Performance#preferring-base-types-over-unions), `data.extend()` is
|
48
|
-
To get full type checking, use specific types
|
47
|
+
For [performance reasons](https://github.com/microsoft/TypeScript/wiki/Performance#preferring-base-types-over-unions), `data.extend()` is by default loosely typed.
|
48
|
+
To get full type checking, you can use specific types in one of the following ways:
|
49
49
|
```ts
|
50
|
-
//
|
51
|
-
import { AmmoCategory, ItemPrototype } from "factorio:prototype"
|
52
|
-
|
50
|
+
// Use `satisfies` on types to check types
|
53
51
|
data.extend([
|
54
52
|
{
|
55
53
|
type: "ammo-category",
|
@@ -58,10 +56,27 @@ data.extend([
|
|
58
56
|
{
|
59
57
|
type: "item",
|
60
58
|
name: "bar",
|
61
|
-
// other fields
|
59
|
+
// ...other fields
|
62
60
|
} satisfies ItemPrototype,
|
63
61
|
])
|
64
62
|
|
63
|
+
// List types as a type argument to `extend`:
|
64
|
+
data.extend<AmmoCategory | ItemPrototype>([
|
65
|
+
{
|
66
|
+
type: "ammo-category",
|
67
|
+
name: "foo"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
type: "item",
|
71
|
+
name: "bar",
|
72
|
+
// ...other fields
|
73
|
+
}
|
74
|
+
])
|
75
|
+
|
76
|
+
// Use types on separate variables:
|
77
|
+
const fooCategory: AmmoCategory = {/* ... */}
|
78
|
+
const barItem: ItemPrototype = {/* ... */}
|
79
|
+
data.extend([fooCategory, barItem])
|
65
80
|
```
|
66
81
|
|
67
82
|
### Factorio lualib modules
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "typed-factorio",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.5.1",
|
4
4
|
"description": "Featureful typescript definitions for the Factorio modding api.",
|
5
5
|
"keywords": [
|
6
6
|
"factorio",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"download-latest-json-apis": "ts-node --esm ./scripts/download-latest.ts",
|
28
28
|
"new-version-changelog": "ts-node --esm ./scripts/new-version-changelog.ts",
|
29
29
|
"next-factorio-version": "npm run download-latest-json-apis && npm run clean && npm run generate && npm run check && npm run new-version-changelog && npm version minor",
|
30
|
-
"
|
30
|
+
"next-factorio-version-diff": "ts-node --esm ./scripts/new-version-diff.ts"
|
31
31
|
},
|
32
32
|
"peerDependencies": {
|
33
33
|
"lua-types": "^2.13.1",
|