typed-factorio 0.4.1 → 0.6.1

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 CHANGED
@@ -34,9 +34,11 @@ Note: When types are updated, or released for a new factorio version, you will n
34
34
 
35
35
  ### Settings and data stage
36
36
 
37
- There are also basic definitions for the settings/data stage.
37
+ There are also definitions for the settings/data stage.
38
38
 
39
- To avoid type conflicts, the global tables for the settings/data stages have to be declared manually where you need them. The types be imported from `typed-factorio/data-stage-types` and `typed-factorio/settings-stage-types`. Examples:
39
+ To avoid type conflicts, the global tables for the settings/data stages have to be declared manually where you need them. These types can be imported from `typed-factorio/data/types` or `typed-factorio/settings/types`.
40
+
41
+ Example:
40
42
 
41
43
  ```ts
42
44
  import { Data, Mods } from "typed-factorio/data/types"
@@ -58,27 +60,25 @@ Currently, there are types for the following modules:
58
60
  - `util`
59
61
  - `mod-gui`
60
62
 
61
- If you have a need for types to more lualib modules, feel free to open an issue or pull request.
63
+ If you have a need for types to more lualib modules, feel free to open an issue or pull request on GitHub.
62
64
 
63
65
  ## Type features
64
66
 
65
- Typed-factorio has nearly 100% complete types for the runtime stage. Even description-only concepts and some not documented types are filled in manually.
66
-
67
- The only incomplete type is `BlueprintControlBehavior`, which isn't documented anywhere.
67
+ Typed-factorio has 100% complete types for the runtime stage. Description-only concepts and some not documented types are filled in manually.
68
68
 
69
69
  ### Lua features
70
70
 
71
71
  The types include [TypescriptToLua language extensions](https://typescripttolua.github.io/docs/advanced/language-extensions/)
72
- and [lua-types](https://github.com/TypeScriptToLua/lua-types) (for v5.2), as dependencies.
72
+ and [lua-types](https://github.com/TypeScriptToLua/lua-types) (for v5.2) as dependencies.
73
73
 
74
74
  This is to use tstl features such as `LuaLengthMethod` and `LuaMultiReturn`.
75
75
 
76
76
  ### `nil`
77
77
 
78
78
  The types consistently use `undefined` to represent `nil`.
79
- `null` is not used, even though it takes fewer characters to type, because `undefined` in typescript is much more similar to `nil` in lua, and optional parameters/properties already use `undefined`.
79
+ `null` is not used, because `undefined` in typescript is much more similar to `nil` in lua, and optional parameters/properties already use `undefined`.
80
80
 
81
- A class attribute is marked as possibly undefined only if the _read_ type is possibly `nil`. For properties where `nil` is not possible on _read_, but is possible on `write`, you can write `nil` by using `undefined!` or `myNullableValue!`, e.g. `controlBehavior.parameters = undefined!`.
81
+ A class attribute is marked as possibly undefined only if the _read_ type is possibly `nil`. For properties where `nil` is not possible on _read_, but is possible on _write_, you can write `nil` by using `undefined!` or `myNullableValue!`, e.g. `controlBehavior.parameters = undefined!`.
82
82
 
83
83
  ### Variant parameter types
84
84
 
@@ -90,7 +90,7 @@ The type for a specific variant is prefixed with the either variant name or "Oth
90
90
 
91
91
  `script.on_event()`, `script.get/set_filters()`, and `script.raise_event()` all have type checking on the event data/filter type, inferred from what is passed as the event name/id.
92
92
 
93
- You can pass a type parameter to `script.generate_event_name()` with the type of the event data, and it will return an `EventId` that also holds type info of the event data. Other event functions on `script` can then use the type data when the `EventId` is used.
93
+ You can pass a type parameter to `script.generate_event_name()`, and it will return an `EventId` that holds type info of the event data. Event functions on `script` can then use the type data when the `EventId` is passed.
94
94
 
95
95
  ### Array-like types
96
96
 
@@ -98,7 +98,7 @@ Classes that have an index operator, a length operator, and have an array-like s
98
98
 
99
99
  ### Table or array types
100
100
 
101
- For table or array types (e.g. Position), there also are types such as `PositionTable` and `PositionArray` types that refer to the table or array form specifically.
101
+ For table or array types (e.g. Position), there also are types such as `PositionTable` and `PositionArray` that refer to the table or array form specifically.
102
102
 
103
103
  ### LuaGuiElement
104
104
 
@@ -110,4 +110,4 @@ This is done both to provide more accurate types, and for possible integration w
110
110
 
111
111
  ### Examples
112
112
 
113
- Check out the `tests` directory for more examples on particular type features.
113
+ Check out the `test` directory on GitHub for more examples on particular type features.
@@ -5,62 +5,62 @@
5
5
  * numbers, when a function takes a float, the game engine will immediately convert the double-precision number to
6
6
  * single-precision.
7
7
  *
8
- * {@link https://lua-api.factorio.com/1.1.38/Builtin-Types.html#float View documentation}
8
+ * {@link https://lua-api.factorio.com/next/Builtin-Types.html#float View documentation}
9
9
  */
10
- type float = number;
10
+ type float = number
11
11
 
12
12
  /**
13
13
  * A double-precision floating-point number. This is the same data type as all Lua numbers use.
14
14
  *
15
- * {@link https://lua-api.factorio.com/1.1.38/Builtin-Types.html#double View documentation}
15
+ * {@link https://lua-api.factorio.com/next/Builtin-Types.html#double View documentation}
16
16
  */
17
- type double = number;
17
+ type double = number
18
18
 
19
19
  /**
20
20
  * 32-bit signed integer. Possible values are -2,147,483,648 to 2,147,483,647.
21
21
  *
22
- * {@link https://lua-api.factorio.com/1.1.38/Builtin-Types.html#int View documentation}
22
+ * {@link https://lua-api.factorio.com/next/Builtin-Types.html#int View documentation}
23
23
  */
24
- type int = number;
24
+ type int = number
25
25
 
26
26
  /**
27
27
  * 8-bit signed integer. Possible values are -128 to 127.
28
28
  *
29
- * {@link https://lua-api.factorio.com/1.1.38/Builtin-Types.html#int8 View documentation}
29
+ * {@link https://lua-api.factorio.com/next/Builtin-Types.html#int8 View documentation}
30
30
  */
31
- type int8 = number;
31
+ type int8 = number
32
32
 
33
33
  /**
34
34
  * 32-bit unsigned integer. Possible values are 0 to 4,294,967,295.
35
35
  *
36
- * {@link https://lua-api.factorio.com/1.1.38/Builtin-Types.html#uint View documentation}
36
+ * {@link https://lua-api.factorio.com/next/Builtin-Types.html#uint View documentation}
37
37
  */
38
- type uint = number;
38
+ type uint = number
39
39
 
40
40
  /**
41
41
  * 8-bit unsigned integer. Possible values are 0 to 255.
42
42
  *
43
- * {@link https://lua-api.factorio.com/1.1.38/Builtin-Types.html#uint8 View documentation}
43
+ * {@link https://lua-api.factorio.com/next/Builtin-Types.html#uint8 View documentation}
44
44
  */
45
- type uint8 = number;
45
+ type uint8 = number
46
46
 
47
47
  /**
48
48
  * 16-bit unsigned integer. Possible values are 0 to 65535.
49
49
  *
50
- * {@link https://lua-api.factorio.com/1.1.38/Builtin-Types.html#uint16 View documentation}
50
+ * {@link https://lua-api.factorio.com/next/Builtin-Types.html#uint16 View documentation}
51
51
  */
52
- type uint16 = number;
52
+ type uint16 = number
53
53
 
54
54
  /**
55
55
  * 64-bit unsigned integer. Possible values are 0 to 18,446,744,073,709,551,615.
56
56
  *
57
- * {@link https://lua-api.factorio.com/1.1.38/Builtin-Types.html#uint64 View documentation}
57
+ * {@link https://lua-api.factorio.com/next/Builtin-Types.html#uint64 View documentation}
58
58
  */
59
- type uint64 = number;
59
+ type uint64 = number
60
60
 
61
61
  /**
62
62
  * Tables are enclosed in curly brackets, like this `{}`
63
63
  *
64
- * {@link https://lua-api.factorio.com/1.1.38/Builtin-Types.html#table View documentation}
64
+ * {@link https://lua-api.factorio.com/next/Builtin-Types.html#table View documentation}
65
65
  */
66
- type table = object;
66
+ type table = object