-
Notifications
You must be signed in to change notification settings - Fork 11
II. Manual
-
Install JDK (from 8 to 14) and gradle (6 or upper). Make sure the following commands is found.
java javap jjs gradle
-
Install npm (8 or upper).
-
Install tyrian from NPM registry.
npm install -g tyrian
You must specify the exact version for each Maven dependency in package.json
. Versions like ^1.2.3
, ~1.2.3
and 1.2.x
are NOT allowed.
{
"mvnDependencies": {
"com.github.ben-manes.caffeine:caffeine": "3.0.1", // Good
"com.google.code.gson:gson": "^2.7" // Bad
}
}
As for NPM dependencies, you can just use the usual fields for them, such as dependencies
and peerDependencies
.
Here are 3 ways to import Java classes in your TypeScript source.
The most recommended way is to use import X = com.example.X
. Then you can use X
as a type or constructor, e.g.
import ArrayList = java.util.ArrayList
const list: ArrayList<String> = new ArrayList()
If you would like to import some class as a type only, use type X = com.example.X
.
type Raven = com.getsentry.raven.Raven
const raven: Raven = RavenFactory.ravenInstance("DSN")
If you would like to use the constructor or static methods of a class, check out the following examples.
const { Files, Paths } = java.nio.file
Files.readString(Paths.get("..."))
const URI = java.net.URI
let uri = new URI("...")