scrollmonitor icon indicating copy to clipboard operation
scrollmonitor copied to clipboard

WIP: Add typescript typings

Open renestalder opened this issue 7 years ago • 3 comments
trafficstars

Allows to use the scrollMonitor library in TypeScript projects.

Started using the scrollMonitor library in a typescript project and wrote typings to get it working. Calling this a WIP as long I didn't test all the functions and properties, and also because I never published any typings yet.

Also, I'm not sure this has to go to the maintainers repository or to the typings repository. There's a recommendation, but IMHO it doesn't state that one or the other method is a must.

renestalder avatar Mar 14 '18 09:03 renestalder

I don't use typescript so I can only review so much, but it looks right to me.

However, it says on the page you liked to that if the project is not written in Typescript then publishing to the @types namespace is preferred. That seems strange to me, but I think it's so that you know which version of scrollmonitor has types. If I was to change the library it's likely that I would completely forget to update the types, or mess up the types file if I tried.

stutrek avatar Mar 14 '18 14:03 stutrek

Yeah, not sure yet about that part. Will check some other projects. Seems so much more intuitive to have the typings inside the project because this means the developer can skip manual typing installation. But the argument for versioning seems fair.

I'll check. For the moment, I wouldn't recommend to merge, even those typings seems to work so far. Just keeping this here as a reminder.

renestalder avatar Mar 14 '18 15:03 renestalder

Even if we never merge it we should keep the PR open so anyone using TypeScript can +1 it and use it from your fork.

stutrek avatar Mar 14 '18 15:03 stutrek