-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
The 'thisArg' parameter should be used to type 'this' in callbacks to map, filter, etc. #12548
Comments
But |
PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes. |
@mhegazy I've fixed the source. But how can i write the tests for changes? The test suite is so huge, it could take time to figure out. So ask you for how is more direct. |
when enabling noImplicitThis, if assing this argument for methods like `array.forEach` will cause compile error. This commit fixes it. fix microsoft#12548
when enabling noImplicitThis, if assing this argument for methods like `array.forEach` will cause compile error. This commit fixes it. fix microsoft#12548 Note: just use some regexp to batchly update the interfaces: 1. search: `(some|every|forEach|filter|map|find|findindex)(\(.+?: \()(value: .+?, index: number, .+?: .+?\) => .+?, thisArg\?: )any(\): .+?;)` replacement: `$1<Z>$2this: Z, $3Z$4` 2. search: `(some|every|forEach|filter|map|find|findindex)<(.+?)>(\(.+?: \()(value: .+?, index: number, .+?: .+?\) => .+?, thisArg\?: )any(\): .+?;)` replacement: `$1<Z, $2>$3this: Z, $4Z$5`
when enabling `noImplicitThis`, if assing this argument for methods like `array.forEach` will cause compilation error. This commit fixes it. fix microsoft#12548
when enabling `noImplicitThis`, if assing this argument for methods like `array.forEach` will cause compilation error. This commit fixes it. fix microsoft#12548
when enabling `noImplicitThis`, if assing this argument for methods like `array.forEach` will cause compilation error. This commit fixes it. fix microsoft#12548
when enabling `noImplicitThis`, if assing this argument for methods like `array.forEach` will cause compilation error. This commit fixes it. fix microsoft#12548
when enabling `noImplicitThis`, if assing this argument for methods like `array.forEach` will cause compilation error. This commit fixes it. fix microsoft#12548
when enabling `noImplicitThis`, if assing this argument for methods like `array.forEach` will cause compilation error. This commit fixes it. fix microsoft#12548
Should this be reopened in light of #16223? |
TypeScript Version: (2.2.0-dev.20161128)
Code
tets.ts
Expected behavior:
compile with no error output
Actual behavior:
test.ts(8,13): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
As some built-in method of array can assign this, could it be inferred through the scopes?
The text was updated successfully, but these errors were encountered: