Skip to content

Commit d6724f9

Browse files
authored
🤖 Merge PR DefinitelyTyped#74223 [Gimloader] Document commands api by @TheLazySquid
1 parent de0a096 commit d6724f9

File tree

3 files changed

+209
-69
lines changed

3 files changed

+209
-69
lines changed

types/gimloader/gimloader-tests.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ api.patcher; // $ExpectType Readonly<ScopedPatcherApi>
1212
api.plugins; // $ExpectType Readonly<PluginsApi>
1313
api.rewriter; // $ExpectType Readonly<ScopedRewriterApi>
1414
api.storage; // $ExpectType Readonly<ScopedStorageApi>
15+
api.commands; // $ExpectType Readonly<ScopedCommandsApi>
1516

1617
GL.React; // $ExpectType typeof React
1718
GL.UI; // $ExpectType Readonly<UIApi>
@@ -22,6 +23,7 @@ GL.patcher; // $ExpectType Readonly<PatcherApi>
2223
GL.plugins; // $ExpectType Readonly<PluginsApi>
2324
GL.rewriter; // $ExpectType Readonly<RewriterApi>
2425
GL.storage; // $ExpectType Readonly<StorageApi>
26+
GL.commands; // $ExpectType Readonly<CommandsApi>
2527

2628
// @ts-expect-error
2729
GL.onStop;
@@ -48,6 +50,38 @@ api.net.modifyFetchRequest("/path/*/thing", (options) => null);
4850
api.net.modifyFetchRequest("/path/*/thing", (options) => options);
4951
api.net.modifyFetchResponse("/path/*/thing", (response) => response);
5052

53+
api.commands.addCommand({
54+
text: "test",
55+
hidden: () => false,
56+
keywords: ["thing", "thing"],
57+
}, async (context) => {
58+
await context.number({
59+
title: "Number",
60+
decimal: false,
61+
max: 6,
62+
min: 1,
63+
});
64+
await context.select({
65+
title: "Select",
66+
options: [
67+
{
68+
label: "Option 1",
69+
value: "option1",
70+
},
71+
{
72+
label: "Option 2",
73+
value: "option2",
74+
},
75+
],
76+
});
77+
await context.string({
78+
title: "String",
79+
maxLength: 10,
80+
});
81+
});
82+
83+
api.commands.addCommand({ text: () => "something" }, () => {});
84+
5185
GL.stores.phaser; // $ExpectType Phaser
5286
window.stores.phaser; // $ExpectType Phaser
5387
let worldManagerInstance!: Gimloader.Stores.WorldManager;

0 commit comments

Comments
 (0)