Introduction
jsii
allows code in any language to naturally interact with JavaScript classes. It is the technology that enables
the AWS Cloud Development Kit to deliver polyglot libraries from a single codebase!
A class library written in TypeScript can be used in projects authored in TypeScript or Javascript (as usual), but also in C# (and other languages from the .NET family), Go, Java, Python, ... More languages will be added in the future!
Warning
Due to JSON marshaling costs and the absence of a distributed garbage collector feature, jsii
modules are best
suited for development and build tools, as opposed to performance-sensitive or resource-constrained applications.
See Runtime Architecture for more information.
An example is worth a thousand words
Consider the following TypeScript class:
/**
* A simple greeter, hello world style.
*/
export class Greeter {
/**
* Greets the designated person.
*
* @param name the person to greet.
*
* @returns a greeting.
*/
public greet(name: string) {
return `Hello, ${name}!`;
}
}
By compiling our source module using jsii
, we can now package it as modules in one of the supported target languages.
Each target module has the exact same API as the source. This allows users of that target language to use Greeter
like
any other native type:
var greeter = new Greeter();
greeter.Greet("World"); // => Hello, World!
greeter := NewGreeter()
greeter.Greet("World") // => Hello, World!
final Greeter greeter = new Greeter();
greeter.greet("World"); // => Hello, World!
const greeter = new Greeter();
greeter.greet("World"); // => Hello, World!
greeter = Greeter()
greeter.greet("World") # => Hello, World!
How to use this website
The documentation in this website is separated in different topics, which can be navigated using links in the site's header bar:
- The Welcome section provides a high level overview of jsii.
-
The User Guides section includes the following:
- The Library Author Guide is intended for developers who are looking to author libraries using jsii to enable polyglot support for their work.
- The Library Consumer Guide is intended for developers who are consuming libraries generated by jsii in the various supported target languages.
- The Language Implementation is intended for developers who are looking to add support for a new target language in jsii.
-
The Specification provides detailed information on the internal components of jsii.
- The Architecture Decision Records contains the log of all architectural decisions made while developing the jsii project.
How to contribute
The jsii project welcomes all kind of contributions. You can refer to the Contribution Guide on GitHub to get more information about how to contribute to the project in general.
Tip
You can submit pull requests for documentation updates without leaving the comfort of your web browser!
All pages of this website have a icon on the top right of each page that links to a GitHub web editor for the source of the page in question.