typed-factorio 3.35.0 → 3.36.0

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.
@@ -4,7 +4,7 @@
4
4
  * This is only available in the settings or prototype stage.
5
5
  * Only prototypes for the current stage can be accessed.
6
6
  */
7
- declare const data: import("factorio:common").DataGlobal
7
+ declare const data: import("factorio:prototype").Data
8
8
 
9
9
  /**
10
10
  * A table of (mod name -> mod version) for all currently active mods.
package/common/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /** @noResolution */
2
2
  declare module "factorio:common" {
3
- import { ModSetting, LuaBootstrap } from "factorio:runtime"
4
- import { Data } from "factorio:prototype"
3
+ import { Data, PrototypeMap } from "factorio:prototype"
4
+ import { LuaBootstrap, ModSetting } from "factorio:runtime"
5
5
  import { SettingsPrototypeMap } from "factorio:settings"
6
6
  /**
7
7
  * A type map of type name -> prototype type.
@@ -16,28 +16,9 @@ declare module "factorio:common" {
16
16
  readonly name: string
17
17
  }
18
18
 
19
- /**
20
- * See {@link Data} for documentation.
21
- */
22
- export interface DataGlobal<M = GlobalPrototypeMap> {
23
- /**
24
- * A table of the already added prototypes.
25
- * Indexed by prototype type, then by prototype name.
26
- */
27
- readonly raw: {
28
- readonly [type in keyof M]: {
29
- readonly [name in string]?: M[type]
30
- }
31
- }
32
-
33
- extend<P extends AnyPrototype<M>>(prototypes: readonly P[]): void
34
-
35
- is_demo: boolean
36
- }
37
-
38
19
  export interface SettingsGlobal {
39
20
  readonly startup: {
40
- readonly [name: string]: ModSetting
21
+ [name: string]: ModSetting
41
22
  }
42
23
  }
43
24
 
@@ -61,7 +42,7 @@ declare module "factorio:common" {
61
42
  * data.extend(...)
62
43
  * ```
63
44
  */
64
- export type PrototypeData = Data
45
+ export type PrototypeData = Data<PrototypeMap>
65
46
 
66
47
  /**
67
48
  * Represents the `data` global variable for the settings stage.
@@ -74,7 +55,7 @@ declare module "factorio:common" {
74
55
  * data.extend(...)
75
56
  * ```
76
57
  */
77
- export type SettingsData = DataGlobal<SettingsPrototypeMap>
58
+ export type SettingsData = Data<SettingsPrototypeMap>
78
59
 
79
60
  /**
80
61
  * You can optionally extend this interface to provide type checking and autocompletion for custom input names, like so:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typed-factorio",
3
- "version": "3.35.0",
3
+ "version": "3.36.0",
4
4
  "description": "Featureful typescript definitions for the Factorio modding api.",
5
5
  "keywords": [
6
6
  "factorio",
@@ -4846,7 +4846,7 @@ declare module "factorio:prototype" {
4846
4846
  * The data table and its properties are defined in Lua, so their source code can be viewed in {@linkplain https://github.com/wube/factorio-data/blob/master/core/lualib/dataloader.lua dataloader.lua}.
4847
4847
  * @see {@link https://lua-api.factorio.com/2.0.75/types/Data.html Online documentation}
4848
4848
  */
4849
- export interface Data {
4849
+ export interface Data<M = import("factorio:common").GlobalPrototypeMap> {
4850
4850
  /**
4851
4851
  * A dictionary of prototype types to values that themselves are dictionaries of prototype names to specific prototypes.
4852
4852
  *
@@ -4859,14 +4859,11 @@ declare module "factorio:prototype" {
4859
4859
  * local health = data.raw["container"]["wooden-chest"].max_health
4860
4860
  * @see {@link https://lua-api.factorio.com/2.0.75/types/Data.html#raw Online documentation}
4861
4861
  */
4862
- raw: {
4863
- readonly [Type in PrototypeType]: {
4864
- readonly [Name in string]?: PrototypeMap[Type]
4862
+ readonly raw: {
4863
+ [Type in keyof M]: {
4864
+ [Name in string]?: M[Type]
4865
4865
  }
4866
4866
  }
4867
- /**
4868
- * Add additional prototypes.
4869
- */
4870
4867
  /**
4871
4868
  * The primary way to add prototypes to the data table.
4872
4869
  * @example
@@ -4886,7 +4883,7 @@ declare module "factorio:prototype" {
4886
4883
  * data:extend({not_coal, proto2})
4887
4884
  * @see {@link https://lua-api.factorio.com/2.0.75/types/Data.html#extend Online documentation}
4888
4885
  */
4889
- extend<P extends AnyPrototype>(prototypes: readonly P[]): void
4886
+ extend<P extends import("factorio:common").AnyPrototype<M>>(prototypes: readonly P[]): void
4890
4887
  /**
4891
4888
  * Set by the game based on whether the demo or retail version is running. Should not be used by mods.
4892
4889
  * @see {@link https://lua-api.factorio.com/2.0.75/types/Data.html#is_demo Online documentation}