Skip to content
This repository was archived by the owner on Sep 4, 2021. It is now read-only.
This repository was archived by the owner on Sep 4, 2021. It is now read-only.

Typescript4j cannot compile the standard example #14

@dustpuppyNGTI

Description

@dustpuppyNGTI

On the example page (https://www.typescriptlang.org/docs/handbook/typescript-in-5-minutes.html) for typescript there is some simple code. This code cannot be compiled by typescript4j.

public class TypeScriptTest {
    private static final String code =
        "function greeter(person) {\n" +
        "    return \"Hello, \" + person;\n" +
        "}\n" +
        "var user = \"Jane User\";\n" +
        "document.body.innerHTML = greeter(user);\n";

    public static void main(final String... args) {
        final TypescriptCompiler typescript = new TypescriptCompiler();
        typescript.setEcmaScriptVersion(EcmaScriptVersion.ES5);
        typescript.compile(code);
    }
}

This results in the following error:

[  Envjs/1.6 (Rhino; U; Mac OS X x86_64 10.12.6; en-US; rv:1.7.0.rc2) Resig/20070309 PilotFish/1.2.13  ]
[main] ERROR com.mangofactory.typescript.TypescriptCompiler - Failed to initialize Typescript compiler
error on line 652: missing name after . operator
        Errors.abstract = function () {
org.mozilla.javascript.EvaluatorException: missing name after . operator (typescript-0.9.1.1.js#652)
	at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions