TypeScript Setup
acodez comes pre-configured for TypeScript out of the box. You do not need to configure anything — it just works.
The tsconfig.json
json
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"lib": ["ES2020", "DOM"],
"strict": true,
"moduleResolution": "bundler",
"resolveJsonModule": true,
"skipLibCheck": true,
"noEmit": true
},
"include": ["src"]
}Why noEmit: true?
TypeScript is used purely for type checking. The actual compilation is handled by Esbuild, which is significantly faster than tsc. Running npm run typecheck will run a full type-check without producing output files.
Acode Type Definitions
acode-plugin-types is included as a dev dependency, giving you full autocompletion for the entire Acode API:
typescript
// Full intellisense on all Acode APIs
const editor = window.acode.require("editor");
const toast = window.acode.require<(msg: string, delay: number) => void>("toast");
const commands = window.acode.require("commands");Importing JSON
You can import plugin.json directly with full type safety:
typescript
import plugin from "../plugin.json";
console.log(plugin.id); // string
console.log(plugin.version); // stringType Checking
Run the TypeScript type checker without building:
bash
npm run typecheckThis validates your entire codebase against the Acode type definitions and catches errors before they reach production.