Editor setup
Set up autocomplete and optional type checks for your scripts.
Add autocomplete
Lucent creates script-api.d.ts and jsconfig.json in Documents/Lucent.
It refreshes the generated type file on startup, but preserves a replacement
that no longer has the generated-file header. Open that folder in your editor.
script-api.d.ts adds autocomplete and helpful details for most of the values
you’ll work with. The same jsconfig.json covers loose scripts and script
packages:
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "Node",
"lib": ["ES2020", "DOM"],
"checkJs": false,
"skipLibCheck": true,
"baseUrl": "./packages"
},
"include": [
"script-api.d.ts",
"scripts/**/*.js",
"scripts/**/*.cjs",
"scripts/**/*.d.ts",
"packages/**/*.js",
"packages/**/*.cjs",
"packages/**/*.d.ts"
]
}
Keep jsconfig.json in Documents/Lucent. Packages don’t need their own copy.
A package can include an index.d.ts file for its own exports. Each declaration
is attached to the package’s import name, so two packages can export functions
with the same name without mixing their types.
Turn on type checks
This setup enables autocomplete without reporting type errors. Add // @ts-check
to the top of any script you want checked:
// @ts-check
To check everything instead, set checkJs to true in
Documents/Lucent/jsconfig.json.