Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forEach: The 'this' context of type 'void' is not assignable to method's 'this' of type 'undefined'. #15184

Closed
mjbvz opened this issue Apr 13, 2017 · 0 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Apr 13, 2017

TypeScript Version: 2.3.1-insiders.20170413

Code

['x'].forEach(function foo(x: string) {
        foo(x)
})

Bug:

[ts] The 'this' context of type 'void' is not assignable to method's 'this' of type 'undefined'.

This makes some sense given the typeSignature of forEach. I'm not sure if this is a by-design change with 2.3 or not

@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Apr 13, 2017
@mhegazy mhegazy added the Bug A bug in TypeScript label Apr 13, 2017
@mhegazy mhegazy added this to the TypeScript 2.3.1 milestone Apr 13, 2017
@mhegazy mhegazy self-assigned this Apr 13, 2017
mhegazy added a commit that referenced this issue Apr 13, 2017
mjbvz added a commit to mjbvz/vscode that referenced this issue Apr 13, 2017
Tested recomppiling VSCode with TS2.3. This fixes a few issues that were discovered, including workarounds for:

* microsoft/TypeScript#15184
* microsoft/TypeScript#15185
mjbvz added a commit to microsoft/vscode that referenced this issue Apr 14, 2017
Tested recomppiling VSCode with TS2.3. This fixes a few issues that were discovered, including workarounds for:

* microsoft/TypeScript#15184
* microsoft/TypeScript#15185
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Apr 14, 2017
mhegazy added a commit that referenced this issue Apr 14, 2017
Fix #15184: Use `void` and not `undefined` for `this` parameter types in the library
@microsoft microsoft locked and limited conversation to collaborators Jun 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

2 participants