Skip to content

How could I disable Object.defineProperty(exports, "__esModule", { value: true }); manually #30166

@taoqf

Description

@taoqf

TypeScript Version: 3.3.3333

Search Terms:

#2242

Code

// a.ts
export default function a(){
console.log('i am a');
}

// b.ts
export default function b(){
console.log('i am b');
}

// c.ts
export { default as a } from 'a';
export { default as b } from 'b';

// d.ts

import d from './d'; // for some reason I don't want force my team worker use import d = require('d');

d.a();  // now d is undefined cause I am using esModuleInterop flag while compling into js.

Expected behavior:

log 'i am a'

Actual behavior:

d.a is undefined

Playground Link:

Related Issues:
#2242

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions