Skip to content

Commit bb1a242

Browse files
committed
Set TypeScript target to ES6 (ES2015 / ECMAScript 2015)
Related issue: kaitai-io/kaitai_struct#539 See also kaitai-io/kaitai_struct#542 (comment) --- The ECMAScript 5 (ES5) target was deprecated in TypeScript 6.0, see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-6-0.html#deprecated-target-es5 ES6 (ES2015) is now the TypeScript's lowest target. ES6 is widely supported across JavaScript engines, see https://compat-table.github.io/compat-table/es6/ As can be seen from the table and also from https://zoo.js.org/, there are several non-mainstream JS engines that don't support ES6 classes (which is the main feature we need), namely: * Rhino 1.9.0 - see mozilla/rhino#835 and https://github.com/ivankra/javascript-zoo-data/blob/8d76f329c686f006081842b5c5091880e49efd03/compat-table/rhino.json#L400 * Hermes 0.12.0 - see facebook/hermes#685; Hermes 0.13.0 likely already supports them, Hermes V1 (the default `static_h` branch of the https://github.com/facebook/hermes repo; see https://zoo.js.org/#hermes-v1) definitely does, see https://github.com/ivankra/javascript-zoo-data/blob/8d76f329c686f006081842b5c5091880e49efd03/compat-table/hermes_full.json#L381-L404 * Nashorn 15.7 (labeled "JJS 1.8" at https://compat-table.github.io/compat-table/es6/) - see https://github.com/ivankra/javascript-zoo-data/blob/8d76f329c686f006081842b5c5091880e49efd03/compat-table/nashorn.json#L401 and https://bugs.openjdk.org/browse/JDK-8066046 * Duktape 2.7 - apparently abandoned, see https://github.com/svaarala/duktape (last release in February 2022 and no commits since January 2024) I believe it makes sense to leave these rather outdated JavaScript runtimes behind and no longer support them out of the box in future versions of Kaitai Struct. If any of our users use one of the runtimes listed above or another ES5-only runtime, they can continue using existing versions of Kaitai Struct, or use [Babel](https://babeljs.io/) to transpile ES6 code to ES5.
1 parent 0100f8c commit bb1a242

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1212

1313
/* Language and Environment */
14-
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
14+
"target": "es6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
1616
// "jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "libReplacement": true, /* Enable lib replacement. */
@@ -33,7 +33,7 @@
3333
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
3434
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
3535
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
36-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
36+
"types": ["node"], /* Specify type package names to be included without being referenced in a source file. */
3737
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
3838
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
3939
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */

0 commit comments

Comments
 (0)