Git Product home page Git Product logo

Comments (4)

cjolowicz avatar cjolowicz commented on June 3, 2024

Do you provide a flow libdef? My flow libdef for jest-environment-enzyme is an autogenerated stub.

from enzyme-matchers.

pascalduez avatar pascalduez commented on June 3, 2024

You've got to install Jest's type definitions from flow-typed.

npm i -g flow-typed if you haven't previously.
flow-typed install [email protected] or any version you use.

The Jest definitions contains jest-enzyme ones.

Also from the error you pasted, I guess you need the enzyme ones as well.
flow-typed install [email protected] or any version you use.

from enzyme-matchers.

cjolowicz avatar cjolowicz commented on June 3, 2024

Thanks for your response. I already have the type definitions for [email protected]:

flow-typed/npm/jest_v23.x.x.js

// flow-typed signature: 78c200acffbcc16bba9478f5396c3a00
// flow-typed version: b2980740dd/jest_v23.x.x/flow_>=v0.39.x

I presume flow is not complaining about missing type definitions, but about the missing import.

How do you tell flow that shallow and mount are available as globals?

from enzyme-matchers.

pascalduez avatar pascalduez commented on June 3, 2024

I would create a mock file, but since a definition can't reference or import another one, I'm afraid your up for some copy/pasting of the flow-typed enzyme declaration and make it global.

Or paste that into the enzyme declaration, but it might get overridden on updates.

declare var mount: $PropertyType<$Exports<'enzyme'>, 'mount'>;
declare var shallow: $PropertyType<$Exports<'enzyme'>, 'shallow'>;

from enzyme-matchers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.