Created
March 24, 2017 22:08
-
-
Save nolanlawson/699d0ada539cc87c24668ac7cb73d32f to your computer and use it in GitHub Desktop.
PouchDB in TypeScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 ?