Flow: Missing type annotation for $NonMaybeType

Created on 17 Aug 2018  ยท  9Comments  ยท  Source: facebook/flow

In our larger project we have been using Flow 0.69 but whenever I have tried to update it to a newer version (in this case 0.79) the first error we get is

Error โ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆ /private/tmp/flow/flowlib_33df98b3/core.js:243:47

Missing type annotation for $NonMaybeType.

     240โ”‚     copyWithin(target: number, start: number, end?: number): T[];
     241โ”‚     every(callbackfn: (value: T, index: number, array: Array<T>) => any, thisArg?: any): boolean;
     242โ”‚     fill(value: T, begin?: number, end?: number): Array<T>;
     243โ”‚     filter(callbackfn: typeof Boolean): Array<$NonMaybeType<T>>;
     244โ”‚     filter(callbackfn: (value: T, index: number, array: Array<T>) => any, thisArg?: any): Array<T>;
     245โ”‚     find(callbackfn: (value: T, index: number, array: Array<T>) => any, thisArg?: any): T | void;
     246โ”‚     findIndex(callbackfn: (value: T, index: number, array: Array<T>) => any, thisArg?: any): number;

I haven't seen this in other projects. How would I go about debugging this issue since it seems to come from within Flow itself?

bug

All 9 comments

Thanks for reporting this. I'm currently looking into these issues, specifically when they point to flow libs.

Does your project happen to be open sourced? When they point to the flowlibs they are usually masking the true location of the error. If not, I have a handful of repros of these types of errors on my side and your issue might be fixed as I'm fixing mine.

Hi, great to hear that these issues are under investigation. Unfortunately, the project isn't open source but I'm more than happy to test any Flow pre-releases or run further diagnostics in case there's something I can try out.

If I had to guess the cause, there is some place where you make a call to
filter in exports. Try extract that export into a separate value and
explicitly annotating it and then export it.

Either way, the message should point to that place, not the definition of
filter.

On Sun, Aug 19, 2018 at 12:48 PM, Mikko Matilainen <[email protected]

wrote:

Hi, great to hear that these issues are under investigation.
Unfortunately, the project isn't open source but I'm more than happy to
test any Flow pre-releases or run further diagnostics in case there's
something I can try out.

โ€”
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/flow/issues/6758#issuecomment-414140226, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AIJ9zwwXCxArU_kewGyd0Gri85EpV4pWks5uSZb0gaJpZM4WBpyK
.

Just to follow up: I'm going to try to make these kinds of errors show more information so that it doesn't just point to random places. I hope to have this work done before the next release.

Thanks, sounds really good! I tried going through most of the places where
we use filter but couldn't get rid of the error. I'll stay tuned for
updates ๐Ÿ™‚

On Wed, Aug 22, 2018, 00:22 Jordan Brown notifications@github.com wrote:

Just to follow up: I'm going to try to make these kinds of errors show
more information so that it doesn't just point to random places. I hope to
have this work done before the next release.

โ€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/facebook/flow/issues/6758#issuecomment-414826126, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAEuT51ZSaEQUOJnbgwuiysH4xAAYnlrks5uTHongaJpZM4WBpyK
.

4868da8d7ade283340759938b90c33b2578f18a6 improves these error messages in some cases. Another commit will be pushed soon that also adds more information when you use the --traces=<some number> flag

Awesome! I built the latest Flow master and it reported 0 errors ๐ŸŽ‰

With version 0.79.1 and the same codebase I still get the original error so I guess I'll wait until you guys cut a new release. Thanks for fixing this pesky issue!

Awesome! This is likely from a recent change that won't be out until 0.81.0. I'm glad we were able to fix your issue!

If you come across any more weird missing annotation errors, please tag me in your issue.

I just tried with the newly released 0.80 version and got no errors. So I'm happy to close this issue at this point. Thanks again for your help!

Was this page helpful?
0 / 5 - 0 ratings