typed-factorio 1.8.1 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- package/custom-index-template.d.ts +8 -8
- package/package.json +16 -16
- package/{generated → runtime/generated}/builtin-types.d.ts +0 -0
- package/{generated → runtime/generated}/classes.d.ts +657 -245
- package/{generated → runtime/generated}/concepts.d.ts +156 -45
- package/{generated → runtime/generated}/defines.d.ts +5 -0
- package/{generated → runtime/generated}/events.d.ts +42 -2
- package/{generated → runtime/generated}/global-functions.d.ts +1 -1
- package/{generated → runtime/generated}/global-objects.d.ts +0 -0
- package/{generated → runtime/generated}/index-types.d.ts +0 -0
- package/runtime/index.d.ts +8 -8
- package/.yarn/unplugged/open-npm-8.4.0-df63cfe537/node_modules/open/index.d.ts +0 -153
@@ -654,7 +654,7 @@ interface PollutionMapSettings {
|
|
654
654
|
/**
|
655
655
|
* The amount of pollution eaten by a chunk's tiles as a percentage of 1. Defaults to `1`.
|
656
656
|
*/
|
657
|
-
readonly
|
657
|
+
readonly ageing: double
|
658
658
|
/**
|
659
659
|
* Any amount of pollution larger than this value is visualized as this value instead. Defaults to `150`.
|
660
660
|
*/
|
@@ -2290,7 +2290,7 @@ interface InfinityInventoryFilter {
|
|
2290
2290
|
*/
|
2291
2291
|
readonly mode?: "at-least" | "at-most" | "exactly"
|
2292
2292
|
/**
|
2293
|
-
* The index of this filter in the filters list.
|
2293
|
+
* The index of this filter in the filters list. Not required when writing a filter.
|
2294
2294
|
*/
|
2295
2295
|
readonly index: uint
|
2296
2296
|
}
|
@@ -3166,11 +3166,11 @@ interface WaitCondition {
|
|
3166
3166
|
*/
|
3167
3167
|
readonly compare_type: "and" | "or"
|
3168
3168
|
/**
|
3169
|
-
* Number of ticks to wait or of
|
3169
|
+
* Number of ticks to wait when `type` is `"time"`, or number of ticks of inactivity when `type` is `"inactivity"`.
|
3170
3170
|
*/
|
3171
3171
|
readonly ticks?: uint
|
3172
3172
|
/**
|
3173
|
-
* Only present when `type` is `"item_count"`, `"circuit"` or `"fluid_count"
|
3173
|
+
* Only present when `type` is `"item_count"`, `"circuit"` or `"fluid_count"`, and a circuit condition is configured.
|
3174
3174
|
*/
|
3175
3175
|
readonly condition?: CircuitCondition
|
3176
3176
|
}
|
@@ -3199,11 +3199,11 @@ interface WaitConditionWrite {
|
|
3199
3199
|
*/
|
3200
3200
|
readonly compare_type: "and" | "or"
|
3201
3201
|
/**
|
3202
|
-
* Number of ticks to wait or of
|
3202
|
+
* Number of ticks to wait when `type` is `"time"`, or number of ticks of inactivity when `type` is `"inactivity"`.
|
3203
3203
|
*/
|
3204
3204
|
readonly ticks?: uint
|
3205
3205
|
/**
|
3206
|
-
* Only present when `type` is `"item_count"`, `"circuit"` or `"fluid_count"
|
3206
|
+
* Only present when `type` is `"item_count"`, `"circuit"` or `"fluid_count"`, and a circuit condition is configured.
|
3207
3207
|
*/
|
3208
3208
|
readonly condition?: CircuitConditionWrite
|
3209
3209
|
}
|
@@ -3537,7 +3537,7 @@ interface ModuleEffects {
|
|
3537
3537
|
}
|
3538
3538
|
|
3539
3539
|
/**
|
3540
|
-
* A set of flags.
|
3540
|
+
* A set of flags. Active flags are in the dictionary as `true`, while inactive flags aren't present at all.
|
3541
3541
|
*
|
3542
3542
|
* By default, none of these flags are set.
|
3543
3543
|
*
|
@@ -3675,7 +3675,7 @@ interface EntityPrototypeFlags {
|
|
3675
3675
|
}
|
3676
3676
|
|
3677
3677
|
/**
|
3678
|
-
* A set of flags.
|
3678
|
+
* A set of flags. Active flags are in the dictionary as `true`, while inactive flags aren't present at all.
|
3679
3679
|
*
|
3680
3680
|
* By default, none of these flags are set.
|
3681
3681
|
*
|
@@ -3778,7 +3778,7 @@ type CollisionMaskLayer =
|
|
3778
3778
|
| `layer-${bigint}`
|
3779
3779
|
|
3780
3780
|
/**
|
3781
|
-
* A set of flags.
|
3781
|
+
* A set of flags. Active flags are in the dictionary as `true`, while inactive flags aren't present at all.
|
3782
3782
|
* @see {@link https://lua-api.factorio.com/latest/Concepts.html#CollisionMask Online documentation}
|
3783
3783
|
*/
|
3784
3784
|
type CollisionMask = {
|
@@ -4018,87 +4018,198 @@ interface OtherAttackParameters extends BaseAttackParameters {
|
|
4018
4018
|
*/
|
4019
4019
|
type AttackParameters = ProjectileAttackParameters | StreamAttackParameters | OtherAttackParameters
|
4020
4020
|
|
4021
|
-
interface
|
4021
|
+
interface BaseCapsuleAction {
|
4022
4022
|
/**
|
4023
|
-
* One of `"throw"`, `"equipment-remote"`, `"use-on-self"`.
|
4023
|
+
* One of `"throw"`, `"equipment-remote"`, `"use-on-self"`, `"artillery-remote"`, `"destroy-cliffs"`.
|
4024
4024
|
*/
|
4025
|
-
readonly type: "throw" | "equipment-remote" | "use-on-self"
|
4025
|
+
readonly type: "throw" | "equipment-remote" | "use-on-self" | "artillery-remote" | "destroy-cliffs"
|
4026
|
+
}
|
4027
|
+
|
4028
|
+
/**
|
4029
|
+
* `"throw"` variant of {@link CapsuleAction}.
|
4030
|
+
*/
|
4031
|
+
interface ThrowCapsuleAction extends BaseCapsuleAction {
|
4032
|
+
readonly type: "throw"
|
4033
|
+
readonly attack_parameters: AttackParameters
|
4034
|
+
/**
|
4035
|
+
* Whether using the capsule consumes an item from the stack.
|
4036
|
+
*/
|
4037
|
+
readonly uses_stack: boolean
|
4038
|
+
}
|
4039
|
+
|
4040
|
+
/**
|
4041
|
+
* `"equipment-remote"` variant of {@link CapsuleAction}.
|
4042
|
+
*/
|
4043
|
+
interface EquipmentRemoteCapsuleAction extends BaseCapsuleAction {
|
4044
|
+
readonly type: "equipment-remote"
|
4026
4045
|
/**
|
4027
|
-
*
|
4046
|
+
* Name of the {@link LuaEquipmentPrototype}.
|
4028
4047
|
*/
|
4029
|
-
readonly
|
4048
|
+
readonly equipment: string
|
4049
|
+
}
|
4050
|
+
|
4051
|
+
/**
|
4052
|
+
* `"use-on-self"` variant of {@link CapsuleAction}.
|
4053
|
+
*/
|
4054
|
+
interface UseOnSelfCapsuleAction extends BaseCapsuleAction {
|
4055
|
+
readonly type: "use-on-self"
|
4056
|
+
readonly attack_parameters: AttackParameters
|
4057
|
+
}
|
4058
|
+
|
4059
|
+
/**
|
4060
|
+
* `"artillery-remote"` variant of {@link CapsuleAction}.
|
4061
|
+
*/
|
4062
|
+
interface ArtilleryRemoteCapsuleAction extends BaseCapsuleAction {
|
4063
|
+
readonly type: "artillery-remote"
|
4030
4064
|
/**
|
4031
|
-
*
|
4065
|
+
* Name of the {@link LuaEntityPrototype flare prototype}.
|
4032
4066
|
*/
|
4033
|
-
readonly
|
4067
|
+
readonly flare: string
|
4068
|
+
}
|
4069
|
+
|
4070
|
+
/**
|
4071
|
+
* `"destroy-cliffs"` variant of {@link CapsuleAction}.
|
4072
|
+
*/
|
4073
|
+
interface DestroyCliffsCapsuleAction extends BaseCapsuleAction {
|
4074
|
+
readonly type: "destroy-cliffs"
|
4075
|
+
readonly attack_parameters: AttackParameters
|
4076
|
+
readonly radius: float
|
4077
|
+
readonly timeout: uint
|
4034
4078
|
}
|
4035
4079
|
|
4036
4080
|
/**
|
4037
|
-
*
|
4081
|
+
* Other attributes may be specified depending on `type`:
|
4082
|
+
* - `"throw"`: {@link ThrowCapsuleAction}
|
4083
|
+
* - `"equipment-remote"`: {@link EquipmentRemoteCapsuleAction}
|
4084
|
+
* - `"use-on-self"`: {@link UseOnSelfCapsuleAction}
|
4085
|
+
* - `"artillery-remote"`: {@link ArtilleryRemoteCapsuleAction}
|
4086
|
+
* - `"destroy-cliffs"`: {@link DestroyCliffsCapsuleAction}
|
4087
|
+
* @see {@link https://lua-api.factorio.com/latest/Concepts.html#CapsuleAction Online documentation}
|
4088
|
+
*/
|
4089
|
+
type CapsuleAction =
|
4090
|
+
| ThrowCapsuleAction
|
4091
|
+
| EquipmentRemoteCapsuleAction
|
4092
|
+
| UseOnSelfCapsuleAction
|
4093
|
+
| ArtilleryRemoteCapsuleAction
|
4094
|
+
| DestroyCliffsCapsuleAction
|
4095
|
+
|
4096
|
+
/**
|
4097
|
+
* A set of flags on a selection tool that define how entities and tiles are selected. Active flags are in the dictionary as `true`, while inactive flags aren't present at all.
|
4038
4098
|
*
|
4039
4099
|
* **Options:**
|
4040
|
-
* - `"blueprint"`:
|
4041
|
-
* - `"deconstruct"`:
|
4042
|
-
* - `"cancel-deconstruct"`:
|
4043
|
-
* - `"
|
4044
|
-
* - `"trees"
|
4045
|
-
* - `"buildable-type"`:
|
4046
|
-
* - `"nothing"`:
|
4047
|
-
* - `"items-to-place"`:
|
4048
|
-
* - `"any-entity"
|
4049
|
-
* - `"any-tile"
|
4050
|
-
* - `"same-force"`:
|
4051
|
-
* - `"not-same-force"
|
4052
|
-
* - `"friend"
|
4053
|
-
* - `"enemy"
|
4054
|
-
* - `"upgrade"
|
4055
|
-
* - `"cancel-upgrade"
|
4056
|
-
* - `"
|
4057
|
-
* - `"entity-with-
|
4058
|
-
* - `"entity-with-
|
4100
|
+
* - `"blueprint"`: Selects entities and tiles as if selecting them for a blueprint.
|
4101
|
+
* - `"deconstruct"`: Selects entities and tiles as if selecting them for deconstruction.
|
4102
|
+
* - `"cancel-deconstruct"`: Selects entities and tiles as if selecting them for deconstruction cancellation.
|
4103
|
+
* - `"items"`: Selects items on the ground.
|
4104
|
+
* - `"trees"`: Selects trees.
|
4105
|
+
* - `"buildable-type"`: Selects entities which are considered a {@link LuaEntityPrototype#is_building building}, plus landmines.
|
4106
|
+
* - `"nothing"`: Selects no entities or tiles, but is useful to select an area.
|
4107
|
+
* - `"items-to-place"`: Selects entities and tiles that can be {@link LuaItemPrototype#place_result built by an item}.
|
4108
|
+
* - `"any-entity"`: Selects all entities.
|
4109
|
+
* - `"any-tile"`: Selects all tiles.
|
4110
|
+
* - `"same-force"`: Selects entities with the same force as the selecting player.
|
4111
|
+
* - `"not-same-force"`: Selects entities with a different force as the selecting player.
|
4112
|
+
* - `"friend"`: Selects entities from a {@link LuaForce#is_friend friendly} force.
|
4113
|
+
* - `"enemy"`: Selects entities from an {@link LuaForce#is_enemy enemy} force.
|
4114
|
+
* - `"upgrade"`: Selects entities as if selecting them for upgrading.
|
4115
|
+
* - `"cancel-upgrade"`: Selects entities as if selecting them for upgrade cancellation.
|
4116
|
+
* - `"downgrade"`: Selects entities as if selecting them for downgrading.
|
4117
|
+
* - `"entity-with-health"`: Selects entities that are {@link LuaEntity#is_entity_with_health entities with health}.
|
4118
|
+
* - `"entity-with-force"`: Deprecated. Replaced by `is-military-target`.
|
4119
|
+
* - `"is-military-target"`: Selects entities that are {@link LuaEntity#is_military_target military targets}.
|
4120
|
+
* - `"entity-with-owner"`: Selects entities that are {@link LuaEntity#is_entity_with_owner entities with owner}.
|
4121
|
+
* - `"avoid-rolling-stock"`: Selects entities that are not `rolling-stocks`.
|
4059
4122
|
* @see {@link https://lua-api.factorio.com/latest/Concepts.html#SelectionModeFlags Online documentation}
|
4060
4123
|
*/
|
4061
4124
|
interface SelectionModeFlags {
|
4062
4125
|
/**
|
4063
|
-
*
|
4126
|
+
* Selects entities and tiles as if selecting them for a blueprint.
|
4064
4127
|
*/
|
4065
4128
|
readonly blueprint?: true
|
4066
4129
|
/**
|
4067
|
-
*
|
4130
|
+
* Selects entities and tiles as if selecting them for deconstruction.
|
4068
4131
|
*/
|
4069
4132
|
readonly deconstruct?: true
|
4070
4133
|
/**
|
4071
|
-
*
|
4134
|
+
* Selects entities and tiles as if selecting them for deconstruction cancellation.
|
4072
4135
|
*/
|
4073
4136
|
readonly "cancel-deconstruct"?: true
|
4074
|
-
|
4137
|
+
/**
|
4138
|
+
* Selects items on the ground.
|
4139
|
+
*/
|
4140
|
+
readonly items?: true
|
4141
|
+
/**
|
4142
|
+
* Selects trees.
|
4143
|
+
*/
|
4075
4144
|
readonly trees?: true
|
4076
4145
|
/**
|
4077
|
-
*
|
4146
|
+
* Selects entities which are considered a {@link LuaEntityPrototype#is_building building}, plus landmines.
|
4078
4147
|
*/
|
4079
4148
|
readonly "buildable-type"?: true
|
4080
4149
|
/**
|
4081
|
-
*
|
4150
|
+
* Selects no entities or tiles, but is useful to select an area.
|
4082
4151
|
*/
|
4083
4152
|
readonly nothing?: true
|
4084
4153
|
/**
|
4085
|
-
*
|
4154
|
+
* Selects entities and tiles that can be {@link LuaItemPrototype#place_result built by an item}.
|
4086
4155
|
*/
|
4087
4156
|
readonly "items-to-place"?: true
|
4157
|
+
/**
|
4158
|
+
* Selects all entities.
|
4159
|
+
*/
|
4088
4160
|
readonly "any-entity"?: true
|
4161
|
+
/**
|
4162
|
+
* Selects all tiles.
|
4163
|
+
*/
|
4089
4164
|
readonly "any-tile"?: true
|
4090
4165
|
/**
|
4091
|
-
*
|
4166
|
+
* Selects entities with the same force as the selecting player.
|
4092
4167
|
*/
|
4093
4168
|
readonly "same-force"?: true
|
4169
|
+
/**
|
4170
|
+
* Selects entities with a different force as the selecting player.
|
4171
|
+
*/
|
4094
4172
|
readonly "not-same-force"?: true
|
4173
|
+
/**
|
4174
|
+
* Selects entities from a {@link LuaForce#is_friend friendly} force.
|
4175
|
+
*/
|
4095
4176
|
readonly friend?: true
|
4177
|
+
/**
|
4178
|
+
* Selects entities from an {@link LuaForce#is_enemy enemy} force.
|
4179
|
+
*/
|
4096
4180
|
readonly enemy?: true
|
4181
|
+
/**
|
4182
|
+
* Selects entities as if selecting them for upgrading.
|
4183
|
+
*/
|
4097
4184
|
readonly upgrade?: true
|
4185
|
+
/**
|
4186
|
+
* Selects entities as if selecting them for upgrade cancellation.
|
4187
|
+
*/
|
4098
4188
|
readonly "cancel-upgrade"?: true
|
4189
|
+
/**
|
4190
|
+
* Selects entities as if selecting them for downgrading.
|
4191
|
+
*/
|
4192
|
+
readonly downgrade?: true
|
4193
|
+
/**
|
4194
|
+
* Selects entities that are {@link LuaEntity#is_entity_with_health entities with health}.
|
4195
|
+
*/
|
4099
4196
|
readonly "entity-with-health"?: true
|
4197
|
+
/**
|
4198
|
+
* Deprecated. Replaced by `is-military-target`.
|
4199
|
+
*/
|
4100
4200
|
readonly "entity-with-force"?: true
|
4201
|
+
/**
|
4202
|
+
* Selects entities that are {@link LuaEntity#is_military_target military targets}.
|
4203
|
+
*/
|
4204
|
+
readonly "is-military-target"?: true
|
4205
|
+
/**
|
4206
|
+
* Selects entities that are {@link LuaEntity#is_entity_with_owner entities with owner}.
|
4207
|
+
*/
|
4101
4208
|
readonly "entity-with-owner"?: true
|
4209
|
+
/**
|
4210
|
+
* Selects entities that are not `rolling-stocks`.
|
4211
|
+
*/
|
4212
|
+
readonly "avoid-rolling-stock"?: true
|
4102
4213
|
}
|
4103
4214
|
|
4104
4215
|
interface LogisticFilter {
|
@@ -4298,7 +4409,7 @@ interface ScriptRenderTarget {
|
|
4298
4409
|
}
|
4299
4410
|
|
4300
4411
|
/**
|
4301
|
-
* A set of flags.
|
4412
|
+
* A set of flags. Active flags are in the dictionary as `true`, while inactive flags aren't present at all.
|
4302
4413
|
*
|
4303
4414
|
* To write to this, use an array[`string`] of the mouse buttons that should be possible to use with on button. The flag `"left-and-right"` can also be set, which will set `"left"` and `"right"` to `true`.
|
4304
4415
|
*
|
@@ -1323,6 +1323,10 @@ declare namespace defines {
|
|
1323
1323
|
* Event type: {@link OnPlayerReverseSelectedAreaEvent}
|
1324
1324
|
*/
|
1325
1325
|
const on_player_reverse_selected_area: EventId<OnPlayerReverseSelectedAreaEvent>
|
1326
|
+
/**
|
1327
|
+
* Event type: {@link OnPlayerAltReverseSelectedAreaEvent}
|
1328
|
+
*/
|
1329
|
+
const on_player_alt_reverse_selected_area: EventId<OnPlayerAltReverseSelectedAreaEvent>
|
1326
1330
|
}
|
1327
1331
|
/**
|
1328
1332
|
* See the {@linkplain https://lua-api.factorio.com/latest/events.html events page} for more info on what events contain and when they get raised.
|
@@ -1377,6 +1381,7 @@ declare namespace defines {
|
|
1377
1381
|
add_permission_group,
|
1378
1382
|
add_train_station,
|
1379
1383
|
admin_action,
|
1384
|
+
alt_reverse_select_area,
|
1380
1385
|
alt_select_area,
|
1381
1386
|
alt_select_blueprint_entities,
|
1382
1387
|
alternative_copy,
|
@@ -1537,6 +1537,45 @@ interface OnPickedUpItemEvent extends EventData {
|
|
1537
1537
|
readonly tick: uint
|
1538
1538
|
}
|
1539
1539
|
|
1540
|
+
/**
|
1541
|
+
* Called after a player alt-reverse-selects an area with a selection-tool item.
|
1542
|
+
* @see {@link https://lua-api.factorio.com/latest/events.html#on_player_alt_reverse_selected_area Online documentation}
|
1543
|
+
*/
|
1544
|
+
interface OnPlayerAltReverseSelectedAreaEvent extends EventData {
|
1545
|
+
/**
|
1546
|
+
* The player doing the selection.
|
1547
|
+
*/
|
1548
|
+
readonly player_index: PlayerIndex
|
1549
|
+
/**
|
1550
|
+
* The surface selected.
|
1551
|
+
*/
|
1552
|
+
readonly surface: LuaSurface
|
1553
|
+
/**
|
1554
|
+
* The area selected.
|
1555
|
+
*/
|
1556
|
+
readonly area: BoundingBox
|
1557
|
+
/**
|
1558
|
+
* The item used to select the area.
|
1559
|
+
*/
|
1560
|
+
readonly item: string
|
1561
|
+
/**
|
1562
|
+
* The entities selected.
|
1563
|
+
*/
|
1564
|
+
readonly entities: LuaEntity[]
|
1565
|
+
/**
|
1566
|
+
* The tiles selected.
|
1567
|
+
*/
|
1568
|
+
readonly tiles: LuaTile[]
|
1569
|
+
/**
|
1570
|
+
* Identifier of the event
|
1571
|
+
*/
|
1572
|
+
readonly name: typeof defines.events.on_player_alt_reverse_selected_area
|
1573
|
+
/**
|
1574
|
+
* Tick the event was generated.
|
1575
|
+
*/
|
1576
|
+
readonly tick: uint
|
1577
|
+
}
|
1578
|
+
|
1540
1579
|
/**
|
1541
1580
|
* Called after a player alt-selects an area with a selection-tool item.
|
1542
1581
|
* @see {@link https://lua-api.factorio.com/latest/events.html#on_player_alt_selected_area Online documentation}
|
@@ -2056,7 +2095,8 @@ interface OnPlayerDisplayScaleChangedEvent extends EventData {
|
|
2056
2095
|
}
|
2057
2096
|
|
2058
2097
|
/**
|
2059
|
-
* Called when the player's driving state has changed,
|
2098
|
+
* Called when the player's driving state has changed, meaning a player has either entered or left a vehicle.
|
2099
|
+
* @remarks This event is not raised when the player is ejected from a vehicle due to it being destroyed.
|
2060
2100
|
* @see {@link https://lua-api.factorio.com/latest/events.html#on_player_driving_changed_state Online documentation}
|
2061
2101
|
*/
|
2062
2102
|
interface OnPlayerDrivingChangedStateEvent extends EventData {
|
@@ -3094,7 +3134,7 @@ interface OnPrePlayerLeftGameEvent extends EventData {
|
|
3094
3134
|
}
|
3095
3135
|
|
3096
3136
|
/**
|
3097
|
-
* Called when the player
|
3137
|
+
* Called when the player completes a mining action, but before the entity is potentially removed from the map. This is called even if the entity does not end up being removed. Can be filtered using {@link LuaPrePlayerMinedEntityEventFilter}.
|
3098
3138
|
* @see {@link https://lua-api.factorio.com/latest/events.html#on_pre_player_mined_item Online documentation}
|
3099
3139
|
*/
|
3100
3140
|
interface OnPrePlayerMinedItemEvent extends EventData {
|
@@ -27,7 +27,7 @@ declare function localised_print(string: LocalisedString): void
|
|
27
27
|
* end
|
28
28
|
* ```
|
29
29
|
*
|
30
|
-
* Note that `table_size()` does not work correctly for {@link LuaCustomTable}, their size has to be determined with {@link LuaCustomTable#length LuaCustomTable::
|
30
|
+
* Note that `table_size()` does not work correctly for {@link LuaCustomTable}, their size has to be determined with {@link LuaCustomTable#length LuaCustomTable::length_operator} instead.
|
31
31
|
* @see {@link https://lua-api.factorio.com/latest/Libraries.html#2.-new-functions Online documentation}
|
32
32
|
*/
|
33
33
|
declare function table_size(table: table): uint
|
File without changes
|
File without changes
|
package/runtime/index.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
/// <reference types="lua-types/5.2" />
|
2
2
|
|
3
3
|
// generated
|
4
|
-
/// <reference path="
|
5
|
-
/// <reference path="
|
6
|
-
/// <reference path="
|
7
|
-
/// <reference path="
|
8
|
-
/// <reference path="
|
9
|
-
/// <reference path="
|
10
|
-
/// <reference path="
|
11
|
-
/// <reference path="
|
4
|
+
/// <reference path="./generated/builtin-types.d.ts" />
|
5
|
+
/// <reference path="./generated/global-objects.d.ts" />
|
6
|
+
/// <reference path="./generated/global-functions.d.ts" />
|
7
|
+
/// <reference path="./generated/defines.d.ts" />
|
8
|
+
/// <reference path="./generated/events.d.ts" />
|
9
|
+
/// <reference path="./generated/classes.d.ts" />
|
10
|
+
/// <reference path="./generated/concepts.d.ts" />
|
11
|
+
/// <reference path="./generated/index-types.d.ts" />
|
12
12
|
|
13
13
|
// other runtime
|
14
14
|
/// <reference path="librariesAndFunctions.d.ts" />
|
@@ -1,153 +0,0 @@
|
|
1
|
-
import {ChildProcess} from 'child_process';
|
2
|
-
|
3
|
-
declare namespace open {
|
4
|
-
interface Options {
|
5
|
-
/**
|
6
|
-
Wait for the opened app to exit before fulfilling the promise. If `false` it's fulfilled immediately when opening the app.
|
7
|
-
|
8
|
-
Note that it waits for the app to exit, not just for the window to close.
|
9
|
-
|
10
|
-
On Windows, you have to explicitly specify an app for it to be able to wait.
|
11
|
-
|
12
|
-
@default false
|
13
|
-
*/
|
14
|
-
readonly wait?: boolean;
|
15
|
-
|
16
|
-
/**
|
17
|
-
__macOS only__
|
18
|
-
|
19
|
-
Do not bring the app to the foreground.
|
20
|
-
|
21
|
-
@default false
|
22
|
-
*/
|
23
|
-
readonly background?: boolean;
|
24
|
-
|
25
|
-
/**
|
26
|
-
__macOS only__
|
27
|
-
|
28
|
-
Open a new instance of the app even it's already running.
|
29
|
-
|
30
|
-
A new instance is always opened on other platforms.
|
31
|
-
|
32
|
-
@default false
|
33
|
-
*/
|
34
|
-
readonly newInstance?: boolean;
|
35
|
-
|
36
|
-
/**
|
37
|
-
Specify the `name` of the app to open the `target` with, and optionally, app `arguments`. `app` can be an array of apps to try to open and `name` can be an array of app names to try. If each app fails, the last error will be thrown.
|
38
|
-
|
39
|
-
The app name is platform dependent. Don't hard code it in reusable modules. For example, Chrome is `google chrome` on macOS, `google-chrome` on Linux and `chrome` on Windows. If possible, use [`open.apps`](#openapps) which auto-detects the correct binary to use.
|
40
|
-
|
41
|
-
You may also pass in the app's full path. For example on WSL, this can be `/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe` for the Windows installation of Chrome.
|
42
|
-
|
43
|
-
The app `arguments` are app dependent. Check the app's documentation for what arguments it accepts.
|
44
|
-
*/
|
45
|
-
readonly app?: App | readonly App[];
|
46
|
-
|
47
|
-
/**
|
48
|
-
Allow the opened app to exit with nonzero exit code when the `wait` option is `true`.
|
49
|
-
|
50
|
-
We do not recommend setting this option. The convention for success is exit code zero.
|
51
|
-
|
52
|
-
@default false
|
53
|
-
*/
|
54
|
-
readonly allowNonzeroExitCode?: boolean;
|
55
|
-
}
|
56
|
-
|
57
|
-
interface OpenAppOptions extends Omit<Options, 'app'> {
|
58
|
-
/**
|
59
|
-
Arguments passed to the app.
|
60
|
-
|
61
|
-
These arguments are app dependent. Check the app's documentation for what arguments it accepts.
|
62
|
-
*/
|
63
|
-
readonly arguments?: readonly string[];
|
64
|
-
}
|
65
|
-
|
66
|
-
type AppName =
|
67
|
-
| 'chrome'
|
68
|
-
| 'firefox'
|
69
|
-
| 'edge';
|
70
|
-
|
71
|
-
type App = {
|
72
|
-
name: string | readonly string[];
|
73
|
-
arguments?: readonly string[];
|
74
|
-
};
|
75
|
-
}
|
76
|
-
|
77
|
-
// eslint-disable-next-line no-redeclare
|
78
|
-
declare const open: {
|
79
|
-
/**
|
80
|
-
Open stuff like URLs, files, executables. Cross-platform.
|
81
|
-
|
82
|
-
Uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
|
83
|
-
|
84
|
-
There is a caveat for [double-quotes on Windows](https://github.com/sindresorhus/open#double-quotes-on-windows) where all double-quotes are stripped from the `target`.
|
85
|
-
|
86
|
-
@param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. For example, URLs open in your default browser.
|
87
|
-
@returns The [spawned child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess). You would normally not need to use this for anything, but it can be useful if you'd like to attach custom event listeners or perform other operations directly on the spawned process.
|
88
|
-
|
89
|
-
@example
|
90
|
-
```
|
91
|
-
import open = require('open');
|
92
|
-
|
93
|
-
// Opens the image in the default image viewer
|
94
|
-
await open('unicorn.png', {wait: true});
|
95
|
-
console.log('The image viewer app closed');
|
96
|
-
|
97
|
-
// Opens the url in the default browser
|
98
|
-
await open('https://sindresorhus.com');
|
99
|
-
|
100
|
-
// Opens the URL in a specified browser.
|
101
|
-
await open('https://sindresorhus.com', {app: {name: 'firefox'}});
|
102
|
-
|
103
|
-
// Specify app arguments.
|
104
|
-
await open('https://sindresorhus.com', {app: {name: 'google chrome', arguments: ['--incognito']}});
|
105
|
-
```
|
106
|
-
*/
|
107
|
-
(
|
108
|
-
target: string,
|
109
|
-
options?: open.Options
|
110
|
-
): Promise<ChildProcess>;
|
111
|
-
|
112
|
-
/**
|
113
|
-
An object containing auto-detected binary names for common apps. Useful to work around cross-platform differences.
|
114
|
-
|
115
|
-
@example
|
116
|
-
```
|
117
|
-
import open = require('open');
|
118
|
-
|
119
|
-
await open('https://google.com', {
|
120
|
-
app: {
|
121
|
-
name: open.apps.chrome
|
122
|
-
}
|
123
|
-
});
|
124
|
-
```
|
125
|
-
*/
|
126
|
-
apps: Record<open.AppName, string | readonly string[]>;
|
127
|
-
|
128
|
-
/**
|
129
|
-
Open an app. Cross-platform.
|
130
|
-
|
131
|
-
Uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
|
132
|
-
|
133
|
-
@param name - The app you want to open. Can be either builtin supported `open.apps` names or other name supported in platform.
|
134
|
-
@returns The [spawned child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess). You would normally not need to use this for anything, but it can be useful if you'd like to attach custom event listeners or perform other operations directly on the spawned process.
|
135
|
-
|
136
|
-
@example
|
137
|
-
```
|
138
|
-
const {apps, openApp} = require('open');
|
139
|
-
|
140
|
-
// Open Firefox
|
141
|
-
await openApp(apps.firefox);
|
142
|
-
|
143
|
-
// Open Chrome incognito mode
|
144
|
-
await openApp(apps.chrome, {arguments: ['--incognito']});
|
145
|
-
|
146
|
-
// Open Xcode
|
147
|
-
await openApp('xcode');
|
148
|
-
```
|
149
|
-
*/
|
150
|
-
openApp: (name: open.App['name'], options?: open.OpenAppOptions) => Promise<ChildProcess>;
|
151
|
-
};
|
152
|
-
|
153
|
-
export = open;
|