IjzerenHein / firestorter

Use Google Firestore in React with zero effort, using MobX 🤘
http://firestorter.com
MIT License
378 stars 50 forks source link

Can't import Mode from Types.d.ts #55

Closed damonmaria closed 6 years ago

damonmaria commented 6 years ago

I'm trying to use the new Typescript features in a create-react-app (using react-scripts-ts) based project.

I can perform some imports from firestorter/lib/Types, example: import { DocumentSource, IDocumentOptions } from 'firestorter/lib/Types' works fine.

But if I try to provide the mode in the Collection constructor options then importing Mode from firestorter/lib/Types fails to compile.

import { Mode } from 'firestorter/lib/Types'
const sites = new Collection('sites', { mode: Mode.On })

results in: Module not found: Can't resolve 'firestorter/lib/Types' in '/Users/damon/development/mindhive/autoflocc/cloud/firebase/client/src/store'

This seems like I've got something wrong. How do I use mode with Typescript?

IjzerenHein commented 6 years ago

Hi. Thanks for letting me know! I'll take a look at it and get back to you later today. cheers, Hein

IjzerenHein commented 6 years ago

Not exactly sure what's going on there. Nevertheless, I've added Mode as a regular export, so it can also be used with plain JavaScript. This also fixed the TypeScript problem. You can now import it directly like this with TypeScript import { Mode } from 'firestorter'; Released as https://github.com/IjzerenHein/firestorter/releases/tag/v1.1.1 cheers