Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Created March 24, 2017 22:08
Show Gist options
  • Save nolanlawson/699d0ada539cc87c24668ac7cb73d32f to your computer and use it in GitHub Desktop.
Save nolanlawson/699d0ada539cc87c24668ac7cb73d32f to your computer and use it in GitHub Desktop.
PouchDB in TypeScript
import * as PouchDB from 'pouchdb'
type Person = {
name: String,
age: Number
}
const db = new PouchDB<Person>('person_db')
async function main() {
await db.put({_id: 'nolan', name: 'Nolan', age: 31})
const doc = await db.get('nolan')
}
main().catch(console.log.bind(console))
@jcharnley
Copy link

Seems like you cannot use import * as PouchDB from 'pouchdb' anymore with TS. I can use Import PouchDB from 'pouchdb'; tho however then my jest unit tests dont like it. Any chance you could review this implementation please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment