Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.js 20 LTS compatibility #28

Open
ebiton-eig opened this issue Oct 26, 2023 · 4 comments
Open

Node.js 20 LTS compatibility #28

ebiton-eig opened this issue Oct 26, 2023 · 4 comments

Comments

@ebiton-eig
Copy link

ebiton-eig commented Oct 26, 2023

LingToTypescript does not work with node.js 20 LTS.

Uncaught SyntaxError: Illegal continue statement: 'outerLoop' does not denote an iteration statement (at linq-to-typescript.js?v=09a07e09:3073:26)

@arogozine
Copy link
Owner

So, I've updated the tests to use Node 20.10.0 and they all ran without an issue.

How are you getting this error?

@ebiton-eig
Copy link
Author

After more testing, the problem is with SSR enabled. It's easy to reproduce:

Create a new project Angular 17 with SSR enabled.

In the app.component.ts:

import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterOutlet } from '@angular/router';
import { from } from 'linq-to-typescript';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [CommonModule, RouterOutlet],
  templateUrl: './app.component.html',
  styleUrl: './app.component.scss'
})
export class AppComponent {
  title = 'test';
  test = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];

  constructor() {
    const result = from(this.test).any(x => x === `'a');`
    console.log(result);
  }
}

And the error when you build:

ng build

An unhandled exception occurred: Illegal continue statement: 't' does not denote an iteration statement
See "C:\Users\xxxx\AppData\Local\Temp\ng-ao6Efq\angular-errors.log" for further details.
[error] SyntaxError: Illegal continue statement: 't' does not denote an iteration statement
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:155:18)
    at callTranslator (node:internal/modules/esm/loader:285:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:30)

No problem with an Angular 17 app without SSR enabled.

@arogozine
Copy link
Owner

Might be related to #29

I wonder if Server-Side Rendering is trying to transpile down the async for loops with a continue outerLoop label and failing

@ebiton-eig
Copy link
Author

No fix for this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants