DEV Community

Carlos Villavicencio
Carlos Villavicencio

Posted on


My first TypeScript open source contribution

While working on a story, I was asked to upgrade the openpgp Node dependency, but bad luck a lot of tests broke.

After digging a bit and implement the included changes the code was not compiling due to some issues with the types. I forgot to mention that I'm using TypeScript for this one. So many types were outdated so I decided to open a PR to the types library DefinitelyTyped. Here's the PR:

Update openpgp type definitions to support async functions #30351

po5i avatar
po5i posted on

Please fill in this template.

  • [x] Use a meaningful title for the pull request. Include the name of the package modified.
  • [x] Test the change in your own code. (Compile and run.)
  • [x] Add or edit tests to reflect the change. (Run with npm test.)
  • [x] Follow the advice from the readme.
  • [x] Avoid common mistakes.
  • [x] Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If changing an existing definition:

It got merged really fast and now my name is part of the authors

I found this bigger than the one I did for Babel:

Bumped lodash version #7895

po5i avatar
po5i posted on
Q                       A
Fixed Issues? No
Patch: Bug Fix? No
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Yes
Documentation PR No
Any Dependency Changes? Yes
License MIT

Bumped lodash dependency version due to a known vulnerability described here:

Happy coding!

Top comments (0)

11 Tips That Make You a Better Typescript Programmer


1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields


Read the whole post now!