question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to compile to ES5 target without success

See original GitHub issue

Hello, I just tried to compile to ES5 target Ajv v7.2.4 on node v14.17.0 with npm v6.14.13, and also Ajv v8.3.0 on node v16.1.0 with npm v7.11.2 to the same target. My tsconfig.json is:

$ cat tsconfig.json 
{
  "extends": "@ajv-validator/config",
  "include": ["lib"],
  "compilerOptions": {
    "outDir": "dist",
    "lib": ["ES5"],
    "types": ["node"],
    "allowJs": true,
    "target": "ES5",
    "resolveJsonModule": true
  }
}

Both attempts gave same 7 errors:

> ajv@8.3.0 build
> rm -rf dist && tsc && cp -r lib/refs dist && rm dist/refs/json-schema-2019-09/index.ts && rm dist/refs/json-schema-2020-12/index.ts && rm dist/refs/jtd-schema.ts

lib/compile/codegen/index.ts:250:25 - error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
250     const names = super.names
                            ~~~~~

lib/compile/codegen/index.ts:281:27 - error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
281     return addNames(super.names, this.iteration.names)
                              ~~~~~

lib/compile/codegen/index.ts:302:38 - error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
302     const names = addExprNames(super.names, this.from)
                                         ~~~~~

lib/compile/codegen/index.ts:328:27 - error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
328     return addNames(super.names, this.iterable.names)
                              ~~~~~

lib/compile/codegen/index.ts:378:25 - error TS2340: Only public and protected methods of the base class are accessible via the 'super' keyword.
378     const names = super.names
                            ~~~~~

lib/compile/index.ts:229:21 - error TS2569: Type 'Set<SchemaEnv>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.
229   for (const sch of this._compilations) {
                        ~~~~~~~~~~~~~~~~~~

lib/compile/validate/dataType.ts:55:7 - error TS2322: Type 'Set<string>' is not assignable to type 'Set<"string" | "number" | "boolean" | "object" | "integer" | "null" | "array">'.
  Type 'string' is not assignable to type '"string" | "number" | "boolean" | "object" | "integer" | "null" | "array"'.
55 const COERCIBLE: Set<JSONType> = new Set(["string", "number", "integer", "boolean", "null"])
         ~~~~~~~~~

Found 7 errors.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
shibormotcommented, May 14, 2021

@epoberezkin thank you, I decided to stick with Ajv v6 for now, as I was, because I’m new to Node, transpilation, JS specs, typescript and kitchen of all of that things. I will go deep into it on next big refactoring. Thank you for your lib and good luck)

0reactions
epoberezkincommented, May 14, 2021

@shibormot Actually you can transpile - see this change in docs, about to merge it #1594

Read more comments on GitHub >

github_iconTop Results From Across the Web

Targeting ES5 with TypeScript in Visual Studio - Stack Overflow
Right click your project name and click Properties. In the Properties window select "Typescript Build"; Set ECMAScript version to "ECMAScript 5". I believe ......
Read more >
Transpiling EcmaScript6 code to ES5 using Babel
Compiling it into pure ES5 JavaScript is as simple as the following command: babel View.js. By default it will output the file in...
Read more >
App appears to not transpile correctly to ES5, breaking in IE11
I fixed it by just grabbing the backing TypeScript and putting it in a library folder locally and compiling it. I will report...
Read more >
Angular + Webpack: Upgrade compiler target from es5
The current compiler target is es5 so I would like to upgrade to es2017 or at least ... I've tried several things with...
Read more >
Transpiling ES6 modules to ES5 using Babel - DotNetCurry.com
We can use Babel directly or with a task manager like Gulp to transpile ES6 modules into ES5. This uses Babel to transpile...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found