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

Flow compatibility with globally available functions #89

Open
wpcarro opened this issue May 31, 2018 · 0 comments
Open

Flow compatibility with globally available functions #89

wpcarro opened this issue May 31, 2018 · 0 comments

Comments

@wpcarro
Copy link

wpcarro commented May 31, 2018

I'm using jasmine-check's install function, which I believe globally exposes variables like gen and check, which at runtime is working totally fine. I'm having trouble convincing Flow that these variable are indeed available, however. Here's the install code:

import { install } from 'jasmine-check'

install()

Here are two examples of the Flow errors I'm receiving:

Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ src/routes/Linking/store.test.js:265:5

Cannot resolve name check.

     262│     })
     263│   })
     264│   describe('FETCH_ENTITIES_SUCCESS', () => {
     265│     check.it(
     266│       'propertly updates state with the mapped entities',
     267│       testcheckOptions,
     268│       gen.array(genEntityAPI()),


Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ src/routes/Linking/store.test.js:268:7

Cannot resolve name gen.

     265│     check.it(
     266│       'propertly updates state with the mapped entities',
     267│       testcheckOptions,
     268│       gen.array(genEntityAPI()),
     269│       entitiesAPI => {
     270│         const action = {
     271│           type: Actions.FETCH_ENTITIES_SUCCESS,

For the time being, my workaround is...

declare var gen: any
declare var check: any

...but of course this is hackish and only a temporary solution.

It may also be a separate issue, but when I try and install the type definitions for testcheck using flow-typed, it's 404ing.

Here's the command I'm running...

$ npx flow-typed install testcheck@1.0.0-rc.2

...and the response that I'm receiving...

!! No flow@v0.71.0-compatible libdefs found in flow-typed for the explicitly requested libdefs. !!

Consider using `flow-typed create-stub testcheck@1.0.0-rc.2` to generate an empty libdef that you can fill in.

This is slightly confusing to me, since I've seen the Flow libdefs in this module. Is there an alternative way of installing these that I'm unaware of? Apologies if this is a separate issue, but I thought I'd include that herein just in case it's related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant