@echoder/types
v0.1.0
Published
TypeScript type declarations for echoder namespace globals
Readme
@echoder/types
TypeScript declarations for the Echoder
namespace globals — audio, vis, shape2d, signal, math, shader, and
the rest of the creative-coding API.
An Echoder sketch calls its namespaces as globals, with no imports:
song = audio.file({ path: "./track.wav" });
spectrum = audio.spectrum({ source: song, bins: 256 });
sketch.add(vis.visualizer({ source: spectrum }));This package is what lets an editor complete those names and a typechecker verify them.
Install
npm install --save-dev @echoder/typesThen name it in tsconfig.json (or jsconfig.json) so the globals become
ambient — types is an allow-list, so an entry is required:
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"noEmit": true,
"types": ["@echoder/types"]
},
"include": ["*.js"]
}npx tsc --noEmit then checks your sketch against the real API.
A project created by Echoder Studio is scaffolded with exactly this, so there is usually nothing to set up by hand.
What's inside
globals.d.ts— declares every namespace as a globalnamespaces/<name>.d.ts— one file per namespace, with the full signatures
These are generated from the runtime, not hand-written: the declarations cannot describe a method the runtime does not have.
Versioning
Declarations describe a particular runtime, so pin the version that matches the
Echoder you are writing against rather than tracking latest.
License
MIT
