Skip to content

Promises promises #45

Open
Open
@AGBrown

Description

@AGBrown

Could the best practices (or maybe contributing) guide be updated to include recommendations on how to use promises when building a d.ts file?

We ran into this on AGBrown/pouchdb.d.ts#18 (which we are working on for DefinitelyTyped/DefinitelyTyped#4328). There are 180 files in DT that refer to Promise or Thenable (some are implementation libs for promises, others are consumers of promises), and the styles vary wildly (from referencing various promise d.ts files to redefining their own promises)

It seems like a best practice might be something like:

  1. If the library that the d.ts is for uses a specific implementation of a promise lib, then /// that specific promise lib from inside the d.ts, and add a comment to that effect so nobody tries to change it later.
  2. Otherwise: do not /// a promise lib inside the d.ts; make a note in the readme that the user will need to do that themselves; and /// to es6-promise.d.ts inside the -tests.d.ts file.

However, I would be interested to hear if anyone has a preferred best practice that is different to this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions