TypeScript
Goal
Write a TypeScript block that runs on Node’s native type stripping. Time: 10 minutes. Needs: Node.js 22.6+ (or tsx).
Things to know
- Termorq prefers native Node (22.6+), which strips types without type-checking them and ignores
tsconfig.json. If native support isn’t available, it uses atsxexecutable instead. - Use only erasable syntax: type annotations,
type,interface, andas. Avoidenum,namespace, and parameter properties, because native stripping can’t run them. See Node.js TypeScript support. - Types don’t validate JSON at run time. Keep the
typeofchecks.
Check your run
Execute step prints {"message":"Hello from curl"}. {"trigger":{}} fails with trigger.text must be a string.
Exercise
Accept an inputs.names array (declare inputs: names: {type: array, items: {type: string}} and uses: [inputs.names]), then publish count and first.