Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Incorrect imported function this context using ES6 module #4706

Closed
@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

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions