New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TypeScript type declarations file #15
Conversation
Also just for reference, this might be how this project would look "converted" (with types added inline) to TypeScript: https://github.com/blutorange/Coloris/blob/demo-ts-convert/src/coloris.ts Would help to prevent the library and the types drifting apart. |
Hello @blutorange, thank you for your contribution, however I will not be adding TypeScript support to this tool. I don't like TypeScript, I don't plan to use it, and I think it's one of the worst things that happened to web development along with NPM. This is of course my opinion, but I will stand by it. I would like this tool to stay as simple as possible, and to be written only in standard technologies that are natively supported by modern web browsers. I will eventually remove babel and the ES5 version and only provide the ES6 source and the minified file. If you would like to maintain a fork of this project focusing on TS, I will do what I can to help. P.S: I will fix the typos and mistakes you pointed out in the README file. Thank you for that :) |
@melloware thank you for reviewing the changes :) |
Ok based on your two posts you are ok if I fork it to push to npm and provide typescript? As long as I have your permission I don't mind doing it 😁 |
Of course! Feel free to do so. I will link to your fork in the README file for those who are interested in NPM/TypeScript. |
@mdbassit Thanks for your feedback, I respect your opinion. I understand not everybody likes TypeScript. It didn't take that long and it was a nice exercise, so feel free to close this PR if you want. Two things I'd like to point out regarding TypeScript: (1) it is pretty widely adopted these days, unlike some other languages like Flow (even e.g. the Chrome Dev tools are written in TypeScript); (2) TypeScript nowadays has a strong policy about not adding any non-standard runtime features not supported by the EcmaScript standard; rather, it strives to be simply a type checker, i.e. writing function parameters und return types after a colon ( |
@blutorange Thank you for the additional information. My point was that it doesn't run natively in the browser without transpiling to JS. |
@melloware let me know if you do it 😄 . I'll be glad to help 😉 |
OK thanks guys I will post back here when I have it stood up and on NPM. |
This project is looking great and seems to be gaining a bit of attention already. I know some people who'd like to use this and would like TypeScript support. This PR adds a TypeScript declaration file and updates the
package.json
to point to the declaration file.Note: When this project is publishe to NPM (see #14) and the library structure is changed, some adjustments to the declaration file might be neccessary.
I packed this project via
npm pack
and installed the tarball in a TypeScript project, it picks up the declarations correctly.