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

esbuild outerLoop' error #29

Open
mellogrand opened this issue Dec 1, 2023 · 7 comments · May be fixed by #30
Open

esbuild outerLoop' error #29

mellogrand opened this issue Dec 1, 2023 · 7 comments · May be fixed by #30
Labels

Comments

@mellogrand
Copy link

moving to angular 17 i get a blocking issue using esbuild (does not happen with webpack)
Illegal continue statement: 'outerLoop' does not denote an iteration statement

just wandering if this will affect your great job in the future
thanks

@arogozine
Copy link
Owner

Does this esbuild tool support continue label?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label

@nikel01
Copy link

nikel01 commented Jan 26, 2024

Firstly I want to say thank you for this great package. I have been really glad using it.

I am using Angular 17 and Node 20.11.0

It seems the issue comes from this file, when using esbuild.

import { IAsyncEnumerable, IAsyncEqualityComparer } from "../../types"
import { BasicAsyncEnumerable } from "../BasicAsyncEnumerable"

export const distinctAsync = <TSource>(
    source: AsyncIterable<TSource>,
    comparer: IAsyncEqualityComparer<TSource>): IAsyncEnumerable<TSource> => {

    async function* iterator() {
        const distinctElements: TSource[] = []
        outerLoop:
        for await (const item of source) {
            for (const distinctElement of distinctElements) {
                const found = await comparer(distinctElement, item)
                if (found) {
                    continue outerLoop
                }
            }

            distinctElements.push(item)
            yield item
        }
    }

    return new BasicAsyncEnumerable(iterator)
}

If the label and continue was replaced with a break statement, wouldn't the functionality be retained?

import { IAsyncEnumerable, IAsyncEqualityComparer } from "../../types"
import { BasicAsyncEnumerable } from "../BasicAsyncEnumerable"

export const distinctAsync = <TSource>(
    source: AsyncIterable<TSource>,
    comparer: IAsyncEqualityComparer<TSource>): IAsyncEnumerable<TSource> => {

    async function* iterator() {
        const distinctElements: TSource[] = []
        for await (const item of source) {
            for (const distinctElement of distinctElements) {
                const found = await comparer(distinctElement, item)
                if (found) {
                    break
                }
            }

            distinctElements.push(item)
            yield item
        }
    }

    return new BasicAsyncEnumerable(iterator)
}

I have exactly 0 experience in writing advanced JavaScript and TypeScript as this packages is,
so I do not know if this is dead wrong.

And thanks again for this npm package :)

@Venom1991
Copy link

Venom1991 commented May 18, 2024

Yeah, this just bit me as well. I'm also using Angular 17. Too bad.

michaelmairegger added a commit to michaelmairegger/LinqToTypeScript that referenced this issue May 24, 2024
@michaelmairegger michaelmairegger linked a pull request May 24, 2024 that will close this issue
@michaelmairegger
Copy link

@nikel01 Your code looks wrong, since you are only breakint the inner for loop, not the outer one. I have created a PR to address this issue

@arogozine The issue is introduced when swapping e.g. @angular-devkit/build-angular:browser, @angular-devkit/build-angular:application

@evanw
Copy link

evanw commented May 25, 2024

Hello! I'm the author of esbuild. FWIW I noticed this issue and just fixed this bug in esbuild: https://github.com/evanw/esbuild/releases/tag/v0.21.4. So another solution is potentially to update esbuild instead.

@michaelmairegger
Copy link

@evanw I will try this and report back. Thanks

@michaelmairegger
Copy link

Unfortunately installing esbuild or esbuild-wasm with the 0.21.5 as dev dependency does not solve the problem

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

Successfully merging a pull request may close this issue.

6 participants