/pouchdb.d.ts

Working on an updated DefinitelyTyped definition file for pouchdb

Primary LanguageTypeScriptMIT LicenseMIT

Typescript Definitions for pouchdb (v3.4.0+)

branch build status
master Build Status
dev Build Status
feat Build Status

Health Warnings

  1. What this repo is: It is a dev repo; the structure of the d.ts module layout and interface naming may change significantly in the early stages of development.
  2. What this repo needs: Contributions and discussion.

Motivation:

The current DefinitelyTyped definition file for pouchdb seems to be for Pouch 0.1 (according to the version in the comments). This repo was created just as v3.4.0 was released.

Goals

To make typescript use of pouchdb:

  1. self-documenting through typescript intellisense; intellisense
  2. accessible through a single intuitive new PouchDB(......) call;
  3. support both promise and callback style pouchdb calls; and

therefore to:

  1. type the results of callbacks and promises to allow easy discovery of the "next action";
  2. write documentation for each definition member;
  3. ensure robust multi-contributor definitions through CI; and to
  4. follow the DefinitelyTyped contribution guide.

Contribution

Discussion, Issues and PRs encouraged.

Discussions and Issues

Guide

The current dev methodology is to recreate the test files in the pouchdb/tests folder by building supporting defintions in pouchdb.d.ts and using the public pouchdb api docs to add "correctness" tests. Any changes to the definitions must therefore:

  1. Create a reliable replica of the relevant pouchdb/tests .js files
  2. Include "correctness" tests in pouchdb-tests.ts
  3. Pass the travis build

Currently this has to be "compared by eye": suggestions on improving this welcome

Structure

|--docs							supporting documentation for this repo
|--tests 						replica test files of pouchdb/tests
|  \--integration 				  (example)
|     |--test.basics.extra.ts 	  (example) extra stuff required to make the test file build
|     |--test.basics.ts 		  (example) a replica test file of pouchdb/tests/integration/test.basics.js
|     \--utils.d.ts 		  	  (example) a replica definition file for pouchdb/tests/integration/utils.js
|--typings 						typings files to support tests, builds etc.
|--.travis.yml 					the travis CI settings file
|--license
|--package.json 				the npm package.json file
|--pouchdb-tests.ts 			The "correctness" tests for pouchdb.d.ts
\--pouchdb.d.ts 				The actual pouchdb definitions file

The readme-dt.md contains the final readme for the DefinitelyTyped repository