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

[Bug]: TypeScript export declare JS emit is wrong #9821

Open
robpalme opened this issue Dec 30, 2024 · 0 comments
Open

[Bug]: TypeScript export declare JS emit is wrong #9821

robpalme opened this issue Dec 30, 2024 · 0 comments
Assignees
Labels

Comments

@robpalme
Copy link

Describe the bug

The JS emit for the TS code does not match upstream TypeScript.

Input code

export namespace ns {
    export declare let a: number;
    a = 1;
}

Config

No response

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.10.3&code=H4sIAAAAAAAAA0utKMgvKlHIS8xNLS5ITE5VyCtWqOZSAIJUiExKanJOYlGqQk5qiUKilUJeaW5SapE1WEWigq2CoTVXLQBodLyZRAAAAA%3D%3D&config=H4sIAAAAAAAAA1VPOw7DIAzdOQXy3KFi6NA79BCIOhERAYQdqSjK3QsJpM1mv4%2Ff8yqkhIkMPOVaxrJEnQjTuReEsmf9KQhwjkgm2chw6yxTpQbtCHdoOxhgnUbk6kJSd6WaA1wIhN3RsNl6O%2BT%2FTBPmmJDoKqxS7UeH10TRUmEO72Un2y%2B179HgAT9RDzsPg6VXd3JaUGxfBMLf3xcBAAA%3D

SWC Info output

No response

Expected behavior

JS emit should be:

export var ns;
(function (ns) {
    ns.a = 1;
})(ns || (ns = {}));

Actual behavior

JS emit is invalid:

(function(ns) {
    a = 1;
})(ns || (ns = {}));
export var ns;

Version

1.10.3

Additional context

Similar to: rolldown/rolldown#3048

@robpalme robpalme added the C-bug label Dec 30, 2024
@magic-akari magic-akari self-assigned this Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants