Skip to content

es6 imports translated to modules even when output set to es6 #643

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
tomitrescak opened this issue Oct 5, 2015 · 7 comments
Closed

es6 imports translated to modules even when output set to es6 #643

tomitrescak opened this issue Oct 5, 2015 · 7 comments
Assignees

Comments

@tomitrescak
Copy link

Hi

Up until latest update my es6 imports were left the way they was when transpilig to es6.
From the latest update now they are transpiled to the module representation.

For example:

import TabControl from "../../components/tabs/tab_control";

is transpiled to

var tab_control_1 = require("../../components/tabs/tab_control");

The worst part is, that it breaks the TSX transpilation as for example

  <TabControl tabs={this.state.tabs}>
            {
              this.props.validations.map((validation: BoardValidation, index: number) => {
                return <BoardValidationView key={index} />
              })
            }
</TabControl>

is transpiled to:

<tab_control_1.default tabs={this.state.tabs}>
            {this.props.validations.map((validation, index) => {
            return <BoardValidationView key={index} />;
        })}
          </TabControl>

Note how the closing tag is not transpiled.

I am sure that this is bug in Microsoft transpilation, but can the transpilation of import statements be disabled? Up until today all was working well ... now none of my TS project runs ;((

For completeness, here is my tsconfig

{
    "compilerOptions": {
        "target": "es6",
        "declaration": false,
        "noImplicitAny": true,
        "removeComments": false,
        "noLib": false,
        "preserveConstEnums": true,
        "noEmitHelpers": true,
        "suppressImplicitAnyIndexErrors": true,
        "watch": true,
        "outDir": "../dist",
        "jsx": "preserve"
    },
...
}
@tomitrescak
Copy link
Author

Thanks to the description you left in releases, I've found out that this happens from version 7.1.2 in which you have updated typescript to the latest version. I have also left a comment within their issues.

@patroza
Copy link

patroza commented Oct 5, 2015

I can confirm this issue

@tomitrescak
Copy link
Author

Do now roll back to 7.1.1 which has a previous version of typescript. Seems like a TS issue.

@basarat
Copy link
Member

basarat commented Oct 6, 2015

TypeScript issue report : microsoft/TypeScript#5110

@basarat basarat closed this as completed in c12f896 Oct 6, 2015
@basarat
Copy link
Member

basarat commented Oct 6, 2015

basarat added a commit that referenced this issue Oct 27, 2015
closes #663
refs microsoft/TypeScript#5393
refs #643 @tomitrescak hopefully this doesn't break your code. If it does a code sample would be great 🌹
@basarat basarat reopened this Oct 30, 2015
@basarat basarat self-assigned this Oct 30, 2015
@basarat
Copy link
Member

basarat commented Oct 30, 2015

@basarat
Copy link
Member

basarat commented Oct 30, 2015

Tsconfig / TypeScript : for people using "target" : "es6" they should now also use "module": "es6" in tsconfig compilerOptions

@TypeStrong TypeStrong locked and limited conversation to collaborators Jan 20, 2019
angelestelar5z added a commit to angelestelar5z/atom-typescript that referenced this issue Aug 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants