How to import flow types from react-map-gl?

82 Views Asked by At

According to the react-map-gl docs and github issues, flow.js types are exposed. I can't find the flow types in the source code.

How do I import flow types and how do I find the existing flow types for reference?

1

There are 1 best solutions below

0
On

The project itself doesn't use flow and that's why you can't find types in the source code but it's written in JS with TS definitions that then get converted into flow types during a build stage.

If you install and find the dependency in node_modules you'll find the flow def files there. To import the types, as long as you know the types available to you, you should be able to import them as

import type { blah } from 'react-map-gl';
// or
import { something, type blah } from 'react-map-gl';

But looking further the lib doesn't seem to actually export types so maybe you'll be just doing a lot of typeof Blah