-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Native String#match declaration incorrect #2450
Comments
I just ran into this issue. It causes flow to fail at usage of the
|
- The current declaration of String#match fails when trying to access the 'index' and 'input' properties of the return value. (facebook#2450)
- The current declaration of String#match fails when trying to access the 'index' and 'input' properties of the return value. (facebook#2450)
Any progress? I've had to do some wacky "any" workarounds and the whole thing felt like a big hack. |
@miklass I was actually looking into this this week. However, it seems they don't review PRs often (I have another waiting). |
@milesj embrace the hacks :) I've encountered other issues with definitions and behaviors, for example |
In the meantime, I suggest you add the following to .flowconfig [options]
suppress_comment=.*\\$FlowIssue And then, just before the problematic line, add a comment like this: const rxa = ''.match(/./);
if (rxa) {
// $FlowIssue: https://github.com/facebook/flow/issues/2450
console.log(rxa.index);
} |
PR: #3359 |
Since PR #3359 (9611080) was reverted in commit 3107fb3, I think this issue needs to be reopened. Also see:
|
@miklass @milesj I have a hack that does not involve sprinkling |
The declaration here is incorrect:
flow/lib/core.js
Line 250 in 3a65d83
According to MDN,
match
returns an array of strings as well as anindex
andinput
property.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match
The text was updated successfully, but these errors were encountered: