Registry / aws / ts2asl

ts2asl

JSON →
library0.1.0jsnpmunverified

ts2asl is a TypeScript-to-AWS State Language (ASL) transpiler that converts TypeScript code into Amazon States Language JSON, enabling developers to author AWS Step Functions using standard TypeScript syntax. Version 0.1.0 is the initial release with a focus on a subset of TypeScript features, including variables, conditionals, loops, and async/await. It targets Node >=12.0.0 and ships TypeScript types. Key differentiators vs direct ASL authoring: static type checking, IDE support, and the ability to use familiar programming constructs. Current limitations include no support for classes, enums, or complex generics. Release cadence is not yet established as it is a young project.

npm install ts2asl
INSTALL
IMPORT
SIG · TS2ASL
T
ts2asl
awsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import ts2asl from 'ts2asl'
const ts2asl = require('ts2asl')
Package is ESM-only; CommonJS require is not supported.
compile
import { compile } from 'ts2asl'
const { compile } = require('ts2asl')
Named export compile() is the main entry point for transpilation.
CompileOptions
import type { CompileOptions } from 'ts2asl'
import { CompileOptions } from 'ts2asl'
Use type import for TypeScript types to avoid runtime import.

Converts a simple TypeScript async function into AWS Step Functions ASL format using compile().

import { compile } from 'ts2asl'; const code = ` async function myFunction(input: { name: string }): Promise<string> { const greeting = "Hello, " + input.name; return greeting; } `; const result = compile(code, { fileName: 'myFunction.ts', target: 'stepfunctions' }); console.log(JSON.stringify(result.asl, null, 2));
ts2asl --version
Debug
Known issues
breakingts2asl v0.1.0 does not support TypeScript classes, enums, or namespaces. Using these will cause compile errors or undefined behavior.
fix
Refactor code to use only functions, variables, conditionals, loops, and async/await.
affects: 0.1.0
gotchaOnly a subset of JavaScript/TypeScript built-ins are supported. For example, Array.map, Promise.all, etc. may be silently ignored or cause errors.
fix
Check the supported features list: https://github.com/Stedi/ts2asl#supported-features
affects: 0.1.0
gotchaThe package is ESM-only and requires Node.js >=12.0.0 with 'type': 'module' in package.json or .mjs extension.
fix
Ensure 'type': 'module' is set in your package.json.
affects: 0.1.0
deprecatedNo deprecation notices yet for v0.1.0 as it's the first release.
fix
Stay tuned for future versions.
affects: 0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'ts2asl'
Package not installed or ESM configuration missing.
fix
Run 'npm install ts2asl' and ensure 'type':'module' in package.json.
TypeError: compile is not a function
Using CommonJS require instead of ESM import.
fix
Use 'import { compile } from 'ts2asl'' instead of 'require'.
SyntaxError: Unexpected token 'export'
Running ESM code in a non-ESM context (e.g., Node.js <12 or CJS environment).
fix
Set 'type':'module' in package.json or use .mjs extension.
Error: Unsupported construct: ClassDeclaration
ts2asl does not support classes in the current version.
fix
Replace class with functions and objects.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
41 hits · last 30 days
node
32
OpenAI (training)
2
Resources
ts2asl — npm install ts2asl · libregistry