Node-postgres: Merge TypeScript declarations into repo

Created on 27 Dec 2018  路  5Comments  路  Source: brianc/node-postgres

First of all big kudos out for this great piece of software! I don't know what I would do without it.

Now considering the recent growth of TypeScript usage across the JS / node eco system and the revival of static typing in general:
Would you consider a PR that merges the definitely-typed TS declarations into the main repo?

Background

  • It's tricky to keep the typings package version and the actual package's version in sync over
  • Not only for TypeScript users, but also for useful hints in the IDE
  • Coherence: Keep together what's tightly coupled
  • Submitting a PR to that beast of definitely typed monorepo is a nightmare
  • One npm install instead of two

Let me know what you think :)

Happy holidays!

Most helpful comment

typescript +1

All 5 comments

@andywer In the meantime, if proper use of TypeScript is a priority in your project, consider [pg-promise], which ships with embedded [TypeScript] support.

To point out a precedent: knex.js did exactly that for 0.16.x version. It doesn't mean that same necessarily makes sense for node-postgres as well, but it might :)

+1 to adding type definitions into the main repo. A lot more pleasant when there's updates across major versions to have the types updated in tandem.

There aren't many public API changes to pg (yes it's __that__ awesome!) so I doubt it'd be much of a maintenance burden but I'd be happy to contribute to keeping things in sync and reviewing any potential changes.

You may find this helpful:

https://github.com/sindresorhus/typescript-definition-style-guide

I was specifically interested in the testing recommendations:

https://github.com/sindresorhus/typescript-definition-style-guide#testing

Maintaining types is usually doable for a maintainer that doesn't use types day to day. But I do think having some form of testing consideration should be mandatory for including types in repos. Separate types have no implied guarantee of fitness for every version but I would be uncomfortable including source code in the repo that's untested.

typescript +1

Was this page helpful?
0 / 5 - 0 ratings