-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
typescript iro types #37
Comments
I'm not very familiar with how TypeScript works honestly. How exactly should types be provided? |
@jaames I'm not sure for the time being. All I want to do is work. If I do, I will send PR. It's a great package. Thank you. |
According docs I think the library just has to provide types with a And thank you for the kind words! |
Reopening this. I've been learning Typescript myself recently and I think having official typedefs would be a great idea. |
https://gist.github.com/mksglu/ba4ebff035a16d29a373eb6739ea316d |
@mksglu Nice start! Are you okay if I use this as a base for the official typescript defs? |
@jaames yeah, you can use. |
I believe that the |
@jacob-beltran pika pack would be perfect if it had more config options, like being able to specify the output directory and the ability to replace constants. Without these things it wouldn't really be ideal to move over from rollup right now. |
Just heard about microbundle, it generates UMD and commonJS modules like iro's current setup does, but also I suppose it might be time to think about porting iro.js to Typescript -- anyone down to help out with that? |
I don't really like TypeScript tbh, but sure. I have time and if you want to, I can help you. Would you like that? |
I've nearly completed the Typescript port, you can find the code over in the typescript branch I would really appreciate feedback from anyone more knowledgeable about Typescript, since I'm pretty new to it and there's still lots of things I'm unsure about. My main concerns are the way I had to extend the color picker prop and state types, this seems wrong somehow, yet when I used interfaces with the I'd also like to sure that it exports typedefs properly, because otherwise this would all be rather pointless. Thanks! :) |
Hey @jaames, The reason is that they have to be types. This is a so called intersection type. The way you are extending the component class is as far as I am aware correct. |
Hi @KaanMol Ah, so it's okay to do Also -- Typescript docs are a bit unclear about whether or not I have to declare iro.js as a module somewhere, like
Is that necessary for iro.js or is it just used for defining types for libraries written in JS? Thanks :) |
Hi @jaames, I've did some research about your question, you can declare iro.js as a module. But I assume your bundler already does something like that. |
@KaanMol Yeah, my bad, I mistyped the example in my message The problem was related to updating a component's state by calling setState with only one property, like The bundler does generate |
I think we can just let it go for now, and test if the types are loaded correctly. If that isn’t the case, we can just add it. |
iro.js 5.0.0 (which is written in Typescript) is now in beta if anybody would like to test it! Obviously I don't recommend using it in production, and documentation is still in progress. From NPM:
|
iro.js 5.0.0 is finally out! Thanks everyone for their help with porting the library to Typescript, I'll be sure to credit you in the readme :) |
I want to use it in the project I developed with ReactJS and TypeScript. That's why I need types. Is it possible to provide this?
The text was updated successfully, but these errors were encountered: