Skip to content

Incorrect imported function this context using ES6 module #4706

@falsandtru

Description

@falsandtru

Code

// export.ts
export function foo() {
  'use strict'
  console.log(this);
}

foo();
// import.ts
import { foo } from './export';

foo();

expected

$ node import.js
undefined
undefined

actual

$ node import.js
undefined
{ foo: [Function: foo] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptES6Relates to the ES6 SpecHelp WantedYou can do this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions