Skip to content
This repository was archived by the owner on Jan 18, 2021. It is now read-only.

Commit 99be450

Browse files
committed
[ez.d.ts] update doc
1 parent 2991bf6 commit 99be450

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

ez.d.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,25 +117,32 @@ declare interface CommandOrigin {
117117
worldpos: ScriptPosition;
118118
}
119119

120-
type CommandParameterTypeName = |
121-
"bool" |
122-
"int" |
123-
"float" |
124-
"string" |
125-
"json";
120+
type CommandParameterTypeName =
121+
| "bool"
122+
| "int"
123+
| "float"
124+
| "string"
125+
| "json"
126+
| "enum"
127+
| "players"
128+
| "entities";
126129

127130
type CommandParameterTypeMap<Name extends CommandParameterTypeName> =
128131
Name extends "bool" ? boolean :
129132
Name extends "int" ? number :
130133
Name extends "float" ? number :
131134
Name extends "string" ? string :
132135
Name extends "json" ? Record<string, any> :
136+
Name extends "enum" ? number :
137+
Name extends "entities" ? Entity[] :
138+
Name extends "players" ? PlayerEntry[] :
133139
never;
134140

135141
declare interface CommandParameterDefinition {
136142
name: string;
137143
type: CommandParameterTypeName;
138144
optional: boolean;
145+
enum?: string;
139146
}
140147

141148
type CommandParameterMap<Defs extends CommandParameterDefinition[]> = {
@@ -187,6 +194,13 @@ declare module "ez:command" {
187194
defs: Defs,
188195
handler: (this: CommandOrigin, ...args: CommandParameterMap<Defs>) => CommandHandlerResult
189196
): void;
197+
198+
/**
199+
* Add command enum
200+
* @param name enum name
201+
* @param value enum values
202+
*/
203+
export function addEnum(name: string, value: string[]): void
190204
}
191205

192206
declare interface ItemStack {

0 commit comments

Comments
 (0)