@@ -24,10 +24,10 @@ new GL(); // $ExpectType Api
2424api . React ; // $ExpectType typeof React
2525api . UI ; // $ExpectType Readonly<ScopedUIApi>
2626api . hotkeys ; // $ExpectType Readonly<ScopedHotkeysApi>
27- api . libs ; // $ExpectType Readonly<LibsApi >
27+ api . libs ; // $ExpectType Readonly<ScopedLibsApi >
2828api . net ; // $ExpectType Readonly<ScopedNetApi>
2929api . patcher ; // $ExpectType Readonly<ScopedPatcherApi>
30- api . plugins ; // $ExpectType Readonly<PluginsApi >
30+ api . plugins ; // $ExpectType Readonly<ScopedPluginsApi >
3131api . rewriter ; // $ExpectType Readonly<ScopedRewriterApi>
3232api . storage ; // $ExpectType Readonly<ScopedStorageApi>
3333api . commands ; // $ExpectType Readonly<ScopedCommandsApi>
@@ -64,8 +64,6 @@ api.UI.showModal(document.createElement("div"), {
6464} ) ;
6565
6666api . requestReload ( ) ;
67- api . patcher . before ( { } , "foo" , ( ) => { } ) ;
68- api . patcher . before ( { } , "foo" , ( ) => true ) ;
6967GL . net . gamemode ; // $ExpectType string
7068api . net . gamemode ; // $ExpectType string
7169api . net . onLoad ( ( type , gamemode ) => { } ) ;
@@ -80,6 +78,17 @@ api.rewriter.exposeVar("App", {
8078 multiple : false ,
8179} ) ;
8280
81+ // Test patcher
82+ let object = { a : true , b : ( arg1 : number , arg2 : string ) => true } ;
83+ api . patcher . after ( object , "b" , ( thisVal , args , returnVal ) => {
84+ args [ 0 ] ; // $ExpectType number
85+ args [ 1 ] ; // $ExpectType string
86+ returnVal ; // $ExpectType boolean
87+ } ) ;
88+ // @ts -expect-error
89+ api . patcher . after ( object , "a" , ( ) => { } ) ;
90+
91+ // Test commands
8392api . commands . addCommand ( {
8493 text : "test" ,
8594 hidden : ( ) => false ,
@@ -112,6 +121,7 @@ api.commands.addCommand({
112121
113122api . commands . addCommand ( { text : ( ) => "something" } , ( ) => { } ) ;
114123
124+ // Test stores
115125GL . stores . phaser ; // $ExpectType PhaserStore
116126window . stores . phaser ; // $ExpectType PhaserStore
117127let worldManagerInstance ! : Gimloader . Stores . WorldManager ;
@@ -145,6 +155,13 @@ worldManager.physics.bodies.staticBodies; // $ExpectType Set<string>
145155worldManager . devices . interactives . findClosestInteractiveDevice ( [ ] , 0 , 0 ) ; // $ExpectType Device | undefined
146156worldManager . inGameTerrainBuilder . clearPreviewLayer ( ) ;
147157
158+ // Test colyseus state
159+ api . net . state . characters [ "..." ] . x ; // $ExpectType number
160+ api . net . state . characters . get ( "..." ) ! . x ; // $ExpectType number
161+ api . net . state . teams [ 0 ] . characters [ 0 ] ; // $ExpectType string
162+ api . net . state . mapSettings ; // $ExpectType string
163+
164+ // Test settings
148165api . settings . something ;
149166api . settings . somethingElse ;
150167api . settings . something = 123 ;
0 commit comments