Skip to content
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

Closed

Conversation

blutorange
Copy link

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.

@blutorange
Copy link
Author

blutorange commented Nov 4, 2021

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.

@mdbassit
Copy link
Owner

mdbassit commented Nov 5, 2021

Hello @blutorange, thank you for your contribution, however I will not be adding TypeScript support to this tool.
I feel bad to reject your PR after all the work you have done, but I have a very strong opinion about this.

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 :)

@mdbassit
Copy link
Owner

mdbassit commented Nov 5, 2021

@melloware thank you for reviewing the changes :)

@mdbassit mdbassit added the wontfix This will not be worked on label Nov 5, 2021
@melloware
Copy link
Contributor

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 😁

@mdbassit
Copy link
Owner

mdbassit commented Nov 5, 2021

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.

@blutorange
Copy link
Author

@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 (:) directly in the code instead of in the doc comment.

@blutorange blutorange closed this Nov 5, 2021
@mdbassit
Copy link
Owner

mdbassit commented Nov 5, 2021

@blutorange Thank you for the additional information. My point was that it doesn't run natively in the browser without transpiling to JS.

@VincentMolinie
Copy link

@melloware let me know if you do it 😄 . I'll be glad to help 😉

@melloware
Copy link
Contributor

OK thanks guys I will post back here when I have it stood up and on NPM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants