samuk190 / localbase

A Firebase-Style Database ... Offline!
636 stars 84 forks source link

localbase: could not add Document to users collection #40

Closed maneeshgowd closed 3 years ago

maneeshgowd commented 3 years ago

When I try to add a document to the localbase it is showing me error! my code.. let dB = new Localbase('db'); dB.collection('users').add({ id:1 name: 'random', mail:'any@gmail.com', });

and in my JavaScript import Localbase from "localbase" // Could not find a declaration file for module 'localbase'.

maneeshgowd commented 3 years ago
  1. creating a folder called @types in your src folder
  2. Creating a file in the @types folder with an extension (.d.ts)
  3. adding the below code in the newly created file would work `declare var localbase: any;

declare module "localbase" { export default localbase; } `