moos / wordpos

Part-of-speech utilities for node.js based on the WordNet database.
478 stars 41 forks source link

Error thrown when `rand().then(console.log)` #25

Closed guidsdo closed 6 years ago

guidsdo commented 6 years ago

In the process of writing the types (for Typescript, so people don't need to read a readme to use this) for this awesome library, I had to test every function and their combinations.

Node version: 8.9.4 (latest stable)

When running the following code:

wordpos.rand().then(console.log);

I get..

(node:99162) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot set property 'count' of undefined
(node:99162) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

It does work when I run it with: rand(console.log) or rand({}).then(console.log).

moos commented 6 years ago

Fixed in 1.1.6 -- Thanks!

guidsdo commented 6 years ago

You're welcome! Would you be open to accept the typings for this package in the repo? They will have to be maintained, it's pretty self explanatory and I will help of course

guidsdo commented 6 years ago

https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24007

moos commented 6 years ago

First off, appreciate your effort to add types for wordpos. Hopefully it'll be useful to some people.

Are you asking to maintain the .d.ts file in this repo (instead of on DefinitelyTyped)? Would there be a major benefit in doing so (other than saving someone an extra npm install perhaps)?

Also, how much maintenance would be required?