Skip to content

_1 suffix when converting ES6 import to ES5 #6264

@louy

Description

@louy

Consider this code:

import Test from 'test-file'; 
new Test();

currently it gets compiled to:

var test_file_1 = require('test-file');
new test_file_1.default();

what I would expect is this:

var Test = require('test-file').default;
new Test();

This doesn't fit with the design goals of Typescript. It also causes some problems like #6249 in tsx/jsx.
Any reason for it being the way it is?

Metadata

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions