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

Leading semicolon removed from next line when transforming TypeScript #645

Open
srmagura opened this issue Sep 7, 2021 · 0 comments
Open

Comments

@srmagura
Copy link
Contributor

srmagura commented Sep 7, 2021

TypeScript code:

const actions = {}

type X = number

;(window as any).actions = actions

Sucrase output:

"use strict";const actions = {}



(window ).actions = actions

Playground link

The JS generated by Sucrase will error because there is no semicolon before (window). The JS parser interprets this code as a function call: {}(window) which will explode because {} is not a function.

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

1 participant