Skip to content

TypeScript compiler fails in ES5 environment #28918

Closed
@arktronic

Description

@arktronic

The TypeScript compiler fails to run in the latest stable version of Jint (an ES5 environment) as of version 3.1 and above. The apparent issue is the use of Set, which does not exist prior to ES2015. Additional context tweet.

TypeScript Version: 3.2.2

Code

Executing the compiler in Jint issue reproduction

The repro app executes the same trivial compilation code against TypeScript 3.0.3, which works, and then 3.2.2, which fails. The failure occurs while executing the typescriptServices JS file itself, not while running the ts.transpileModule code.

Output from repro app:

--Works--
Result: var x = 'string';

--Fails--
Exception: ReferenceError: Set is not defined

Expected behavior:

Compiler executes successfully in Jint.

Actual behavior:

Jint throws an exception (see above for exception message).

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIRelates to the public API for TypeScriptBugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions