1c

Full-featured TypeScript on JVM

View on GitHub

Guideline

Limitations

Import Java classes

Here is some examples.

const Files = java.nio.file.Files
const HttpURLConnection = java.net.HttpURLConnection
const Spark = spark.Spark

type Raven = com.getsentry.raven.Raven
const raven: Raven = RavenFactory.ravenInstance("DSN")

Check out Java Scripting Programmer’s Guide for more details.

Extra package.json fields

{
    "mvnDependencies": [
        "com.sparkjava:spark-core:2.5.5",
        "org.tinylog:tinylog:1.2"
    ],
    "webpack": {
        "mode": "production",
        "resolve": {
            "alias": {
                "react": "inferno-compat",
                "react-dom": "inferno-compat"
            }
        },
        "optimization": {
            "splitChunks": {
                "chunks": "all",
                "name": "common.js",
                "minChunks": 3
            }
        }
    }
}