Skip to content

bug: Unable to parse the correct TypeScript code. #4027

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

Closed
rxliuli opened this issue Jan 5, 2025 · 1 comment
Closed

bug: Unable to parse the correct TypeScript code. #4027

rxliuli opened this issue Jan 5, 2025 · 1 comment

Comments

@rxliuli
Copy link

rxliuli commented Jan 5, 2025

An error accidentally discovered while using vitest, which upon inspection was found to be an error that occurred during the esbuild compilation of the code.

image
// src/index.ts
export function open(async?: boolean): void {
  console.log(async as boolean)
}

Command

➜  skitter pnpm esbuild src/index.ts
✘ [ERROR] Expected "=>" but found "boolean"

    src/index.ts:5:23:
      5 │   console.log(async as boolean)
        │                        ~~~~~~~
        ╵                        =>

1 error
➜  skitter pnpm tsc src/index.ts    
➜  skitter 

Of course, this error can be bypassed; I'm just reporting it in case someone else encounters this error as well.


It has been confirmed that both TypeScript and SWC can correctly compile this code.

image
@evanw
Copy link
Owner

evanw commented Jan 7, 2025

Thanks for the report! This has been fixed, and should go out in the next release.

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