Skip to content

Emit of require calls is invalid #9538

Closed
@nullptr128

Description

@nullptr128

TypeScript Version: nightly (2.0.0-dev.20160705)

Code

target: es6 , module: commonjs , moduleResolution: node
(tried target=es5 moduleResolution=classic as well)

File A (index.ts):

import * as TestModule from './test.ts';
let obj = new TestModule.Test();

File B (test.ts):
export class Test {}

Expected behavior:

Emitted index.js file should have:

const TestModule = require('./test.js');

Actual behavior:

Emited index.js file wrongly points at .ts file causing runtime module not found error.

const TestModule = require('./test.ts')

I've searched internet and looked towards BC changes in TypeScript but couldn find anything on this topic. I am 100% sure it changed extensions from .ts to .js in the earlier versions of TypeScript (around 1.5 or so).

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions