jsii-sampiler is a utility for transcribing TypeScript code snippets into other jsii-supported languages (Java, C#, Python, Go, etc.). It is part of the AWS jsii ecosystem and works in tandem with jsii-pacmak for documentation generation. The latest stable version (v1.x) is actively maintained with frequent bug fix releases. It uses grammatical and type-aware translation for compiling or non-compiling samples and supports void masking to hide boilerplate. Its key differentiator is deep integration with the jsii type system, enabling accurate multi-language translations beyond simple text transformation.
npm install jsii-sampilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: translate a TypeScript snippet to Python using the sampile function.
Upgrade Node to >=10.3.0 (but ideally use current LTS).
Ensure void expressions are used only where valid JavaScript/TypeScript syntax allows.
Provide compilable samples with full type annotations for best results.
Replace Sample.sampile() with import { sampile } from 'jsii-sampiler'.Move void directives to statement or comma expression positions where void is syntactically valid.
npm install jsii-sampiler and use import { sampile } from 'jsii-sampiler' (ESM).Use import { sampile } from 'jsii-sampiler', not import sampile from 'jsii-sampiler'.No dependency data recorded yet.