Tooling
TypeScript and editor support
Type declarations for plain JavaScript and TypeScript projects.
The package ships type declarations; nothing needs to be installed except @types/express in a TypeScript project. Plain JavaScript gets completion and checking too:
// white.config.js
import { defineConfig } from 'white-js';
export default defineConfig({ security: { cors: { origin: ['https://app.example.com'] } } });
// server/routes/api/users.js
import { defineRoute } from 'white-js';
export default defineRoute((router, ctx) => {
router.get('/', (req, res) => res.json({ total: ctx.cache.size })); // router, ctx, req and res are all typed
});definePlugin does the same for plugins, and white-js/test is typed as well. The helpers return their argument unchanged; they only exist for the editor.