Wizcorp / locks

Mutex locks, Read/Write locks, Condition variables and Semaphores in JavaScript
105 stars 19 forks source link

Any plan to support Typescript? #18

Closed sneko closed 6 years ago

sneko commented 6 years ago

Hi!

Everything is in the question 😄 , currently I just use declare module 'locks'; to disable errors about library declaration.

Thank you,

ronkorving commented 6 years ago

Hi, I have no plans myself to add TypeScript support, but wouldn't mind merging a PR that adds it, or alternatively a type definition file. If you would like to make a PR that really makes this a TypeScript project, I just have the requirement that pure JavaScript projects must be able to require this module as-is, and that the ReadMe is updated to reflect the impact on JS and TS users. Examples in both flavors would be great. The component.json support may be removed, that package management system is effectively dead and I don't care to support that any longer (I doubt anyone still uses it).

Now it's up to you, if you really want to see this happen ;)

flippynips commented 6 years ago

I've created typed definitions. The pull request requires review before being merged. You can check it out here; https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29215/files

sneko commented 6 years ago

@flippynips thank you very much for this contribution!

Note to use it: Before I was using

import locks from 'locks';
const mutex: any = locks.createMutex();

and now you have to write

import { Mutex } from 'locks';
const mutex = new Mutex();