// readme

TypeScript ART

TypeScript ART compiles a typed subset of TypeScript into Java source. On Android, AGP compiles that source to JVM bytecode and DEX. A TypeScript Activity can subclass android.app.Activity, hold state in primitive fields and install an Android click listener.

import { Button, TextView } from "android.widget"

export function connect(button: Button, label: TextView): void {
  let count: int = 0
  button.setOnClickListener(() => {
    count++
    label.setText("Count: " + count)
  })
}

The Gradle plugin reads Android and dependency classes from the variant classpath. Put sources in src/main/typescript and import other TypeScript modules by relative path. The generated class for a top-level TypeScript class has its declared name and can be referenced from a manifest, Kotlin or Java.

TypeScript Native language reference Β· Playground Β· Language and project file Β· Gradle setup Β· [Counter…