{"id":26523,"library":"ts2workflows","title":"ts2workflows","description":"ts2workflows is a transpiler that converts TypeScript code into GCP Workflows YAML programs, enabling type-safe workflow development. Current version is 0.15.0. It supports a subset of TypeScript features, includes type annotations for Workflows standard library and connectors, and provides CLI for batch compilation. Key differentiators: enables type-checking of workflow sources with tsc, integrates with TypeScript ecosystem, and produces self-contained YAML with subworkflows via --link. Requires Node >=20 and TypeScript >=5.5.4 <6.0.","status":"active","version":"0.15.0","language":"javascript","source_language":"en","source_url":"https://github.com/aajanki/ts2workflows","tags":["javascript","gcp","gcloud","workflows","transpiler","typescript"],"install":[{"cmd":"npm install ts2workflows","lang":"bash","label":"npm"},{"cmd":"yarn add ts2workflows","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts2workflows","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for transpilation and type-checking workflows","package":"typescript","optional":true}],"imports":[{"note":"ESM-only import; transpile() is the main API function","wrong":"const transpile = require('ts2workflows'); transpile()","symbol":"transpile","correct":"import { transpile } from 'ts2workflows'"},{"note":"Type annotations for Workflows standard library are exported from a subpath","wrong":"import { http } from 'ts2workflows'","symbol":"http","correct":"import { http } from 'ts2workflows/types/workflowslib'"},{"note":"Named export from the types subpath","wrong":"import retry_policy from 'ts2workflows'","symbol":"retry_policy","correct":"import { retry_policy } from 'ts2workflows/types/workflowslib'"}],"quickstart":{"code":"// sample.ts - a simple workflow\nimport { http, retry_policy } from 'ts2workflows/types/workflowslib';\n\nasync function myWorkflow(input: { name: string }) {\n  const result = await http.get(`https://api.example.com/greet?name=${input.name}`);\n  return result.body;\n}\n\n// Transpile using CLI:\n// npx ts2workflows sample.ts","lang":"typescript","description":"Shows a basic workflow function with HTTP call and transpilation command."},"warnings":[{"fix":"Upgrade Node and TypeScript to compatible versions","message":"Requires Node >=20, TypeScript >=5.5.4 <6.0.0","severity":"breaking","affected_versions":">=0.15.0"},{"fix":"Review language_reference.md before writing workflows","message":"Only a subset of TypeScript features are supported; see language reference for details. Unsupported features may cause transpilation errors or silent omission.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use --link flag to generate self-contained YAML with all subworkflows","message":"Without --link flag, only subworkflows from the input file are emitted; main workflow code is not included in output.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always provide --project when using --link","message":"--link requires --project argument","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install ts2workflows and use correct import path: 'ts2workflows/types/workflowslib'","cause":"Missing import path or package not installed","error":"Error: Cannot find module 'ts2workflows/types/workflowslib'"},{"fix":"Use ESM import: import { transpile } from 'ts2workflows'","cause":"Using CommonJS require incorrectly","error":"TypeError: transpile is not a function"},{"fix":"Rewrite using supported syntax per language_reference.md","cause":"Using unsupported TypeScript feature (e.g., generators, decorators)","error":"Unsupported syntax: ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}