I am trying to build typescript typings for a mod for Minecraft that runs an embedded…
- User
I am trying to build typescript typings for a mod for Minecraft that runs an embedded version of JavaScript (via Mozilla Rhino). The mod uses 3 folders to load scripts depending on the environment (
server_scripts,client_scripts, andstartup_scripts). The mod creates a folder structure like this:codekubejs ├── client_scripts/ │ ├── script1.js │ └── script2.js ├── server_scripts/ │ ├── script1.js │ └── script2.js ├── startup_scripts/ │ ├── script1.js │ └── script2.jsEach of these environment folders should have a different set of typings since the mod exposes different types based on the environment (in the global scope) and the mod uses namespaces, not modules, so I cant simply rely on modules to only import the correct types. Also, there are some shared types which I put in the
@kubejs/corefolder which needs to be accessible by@kubejs/client,@kubejs/server, and@kubejs/startup. I want to keep the typings out of the scripts folders because eventually I plan on putting them in their own repo so I have my project structured like this so far:codekubejs/ ├── @types/ │ └── @kubejs/ │ ├── core/ │ │ ├── index.d.ts │ │ └── tsconfig.json (extends `tsconfig.base.json`) │ ├── client/ │ │ ├── index.d.ts │ │ └── tsconfig.json (extends `tsconfig.base.json`, references `@kubejs/core`) │ ├── server/ │ │ ├── index.d.ts │ │ └── tsconfig.json (extends `tsconfig.base.json`, references `@kubejs/core`) │ └── startup/ │ ├── index.d.ts │ └── tsconfig.json (extends `tsconfig.base.json`, references `@kubejs/core`) ├── client_scripts/ │ ├── script1.js │ └── script2.js ├── server_scripts/ │ ├── script1.js │ └── script2.js ├── startup_scripts/ │ ├── script1.js │ └── script2.js ├── tsconfig.json └── tsconfig.base.jsonHowever I cant seem to figure out how to get to see the types in . I have tried to adding and / to the but I cant seem to get it working.
- Assistant
To make the types in
@kubejs/coreaccessible to@kubejs/startup, you can follow these steps:- Ensure that the
tsconfig.base.jsonfile includes the necessary configuration for type resolution. Here's an example:
json - Ensure that the
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.