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

Parsing error when satisfies or as follows an Instantiation Expression #22375

Open
hen-x opened this issue Feb 10, 2024 · 2 comments
Open

Parsing error when satisfies or as follows an Instantiation Expression #22375

hen-x opened this issue Feb 10, 2024 · 2 comments
Labels
bug Something isn't working swc related to swc (bundling/transpiling)

Comments

@hen-x
Copy link

hen-x commented Feb 10, 2024

Version: Deno 1.40.4

Consider this one-line TS file:

Array<5> satisfies unknown;

As of Typescript 4.9, this is syntactically correct and also type-checks successfully (playground).

However in Deno 1.40.4 (with Typescript 5.3.3), the CLI instead fails with this diagnostic:

error: The module's source code could not be parsed: Expected ';', '}' or <eof> at file:///redacted/type_tests.ts:1:20

  Array<5> satisfies unknown;
                     ~~~~~~~

This appears to persist when an expression like this is used elsewhere (eg wrapped in parens, used on the RHS of an assignment, etc).

I imagine this is getting mis-parsed as the equivalent of (Array < 5 > satisfies) unknown; which would be invalid. That's just speculation however.

❤️

@dsherret
Copy link
Member

I opened swc-project/swc#8627

@dsherret dsherret added bug Something isn't working swc related to swc (bundling/transpiling) labels Feb 10, 2024
@hen-x
Copy link
Author

hen-x commented Feb 10, 2024

Thanks @dsherret. For posterity, is it a good idea to take parsing issues directly to swc or are we happy tracking them here as well?

@dsherret dsherret changed the title Parsing error when satisfies follows an Instantiation Expression Parsing error when satisfies or as follows an Instantiation Expression Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working swc related to swc (bundling/transpiling)
Projects
None yet
Development

No branches or pull requests

2 participants