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

Typescript import = Namespace isn't transpiled correctly #2234

Closed
mischnic opened this issue Sep 11, 2021 · 1 comment · Fixed by #2249
Closed

Typescript import = Namespace isn't transpiled correctly #2234

mischnic opened this issue Sep 11, 2021 · 1 comment · Fixed by #2249
Labels
Milestone

Comments

@mischnic
Copy link
Contributor

Describe the bug

https://www.typescriptlang.org/docs/handbook/namespaces.html#aliases

Input code

namespace Shapes {
  export namespace Polygons {
    export class Triangle {}
    export class Square {}
  }
}
import polygons = Shapes.Polygons;
let sq = new polygons.Square();

Config

{
	"env": {},
	"jsc": {
		"parser": {
			"syntax": "typescript"
		}
	}
}

Current behavior

var Shapes;
(function(Shapes) {
    var Polygons;
    (function(Polygons) {
        class Triangle {
        }
        Polygons.Triangle = Triangle;
        class Square {
        }
        Polygons.Square = Square;
    })(Polygons || (Polygons = {
    }));
    Shapes.Polygons = Polygons;
})(Shapes || (Shapes = {
}));
let sq = new polygons.Square();
export { };

(polygons is undefined)

Version
The version of @swc/core: 1.2.85

Additional context
parcel-bundler/parcel#6902

@mischnic mischnic added the C-bug label Sep 11, 2021
@kdy1 kdy1 added this to the v1.2.87 milestone Sep 12, 2021
@kdy1 kdy1 changed the title Typescript Alias isn't transpiled correctly Typescript import = Namespace isn't transpiled correctly Sep 14, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Sep 14, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Sep 14, 2021
@kdy1 kdy1 modified the milestones: v1.2.87, v1.2.88 Sep 14, 2021
kdy1 added a commit that referenced this issue Sep 15, 2021
swc_ecma_transforms_compat:
 - Fix `this` in class properties. (#2228)

swc_ecma_transforms_typescript:
 - Handle `import =` correctly. (#2234)
 - Ensure that #1653 is not the case anymore. (#1653)

swc:
 - Ensure that #2232 is not the case. (#2232)
@swc-bot
Copy link
Collaborator

swc-bot commented Oct 22, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants