-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Flow 0.46 Arity Flag #1223
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
Comments
I see the same error. Also happens on Immutable 4.0.0-beta.2 |
Flow 0.47.0 shipped with |
Hit this as well. The solution is to not use the If |
thanks for that. I might open a PR with that as the fix (unless you want to), solely because my linter doesn't like upper-first methods without the Seems weird that immutable doesn't allow this, or use it more in the docs. Is there any reason not to use it? |
Yeah, not too sure about the why. The only place that I could see it being confusing is for Records, which have I'd say a PR is probably a good way to get a discussion going here or at least get an answer. I had one started but abandoned it once I realized none of the tests used |
ahhh okay. fair enough. It just seems weird because then, if I'm not mistaken, import { List } from 'immutable';
const x = new List([]);
const y = List([]);
console.log(x instanceof List); // true
console.log(y instanceof List); // false unless the function calls the constructor if it's not explicitly called. EDIT: looks like they're calling the constructor if it's not called. This is the output I expected: |
So @deecewan, is the solution simply to drop the |
That is correct, although I'm not super happy with that as a solution. It seems the solution would be to fix the type definitions. It feels wrong instantiating a new object of a certain type without the |
I agree, I am not fixing it in my project and would wait for an update to the type definitions. |
Has anyone found a way to change the typedefs so flow doesn't error any more? |
Is there any progress with this? |
@MSch to do this, you'd need to add a For It should look like static <K, V>(obj?: {[key: K]: V}): Map<K, V>;
static <K, V>(collection: Iterable<[K, V]>): Map<K, V>;
constructor <K, V>(obj?: {[key: K]: V}): Map<K, V>;
constructor <K, V>(collection: Iterable<[K, V]>): Map<K, V>; That being said, I haven't tested this, and there would need to be a bunch of new tests written to ensure the libdefs were correct. |
You can disable strict function call arity by adding the following to your .flowconfig
See https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/ |
|
@arv looks like its still there. https://github.com/facebook/flow/blob/v0.52.0/src/commands/config/flowConfig.ml#L804 |
Thanks for the report - in general using Looks like we have these flow errors fixed in what will be the next release. |
Flow has shipped a
strict_call_arity
flag, which will become the only option as of 0.47.With this flag enabled, there are issues using the
Map
constructor, at a minimum (I haven't tried the other data types).MCVE:
flow-bin
v0.46 and thestrict_call_arity
flag setresulting in the following error:
The text was updated successfully, but these errors were encountered: