-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Port to TypeScript (DONT MERGE) #68
Conversation
Currently it looks like everything works? I dont know for sure until I test everything first. And removing all the bullshit I added to make it work quickly ofcourse |
Hey @KaanMol, thanks so much for your work on this! I'm currently away over the weekend so I'll get back to you with a thorough review on Tuesday, hope thats okay :) |
@jaames Ofcourse James, it still isn't finished so take your time! I still have a lot to do anyway |
Just got the chance to review this, it's a pretty good start! A couple of things I wanted to note:
I'm happy to tackle any of these though, so don't worry too much about it Thanks again for the contribution! :) |
Hey James, I used this buildprocess to quickly prototype it, I am going to remove that after I am done. You are correct, I hadn't used preact and the TSC was complaining about typedefs which it couldn't find so I tried several things. The React Typedefs aren't used and will even cause problems if you install them. I have removed them locally. When I made a clean install of my node_modules folder, the preact typedefs were automatically found. Yeah you are right about inheriting proptypes, I still need to clean up a LOT and have to set the correct types everywhere. My goal was just to get it working quickly in TypeScript. I saw that you sometimes change the type of a variable. It is better to keep 1 type for a variable instead of changing it sometimes from lets say a number to a boolean. Have you worked with strongly typed languages before? If you did, then we can probably rewrite all the parts easily together :) |
Fair enough! I totally agree that some code cleanup is needed. Actually, in general a lot of things haven't really changed since they were first implemented, and in the past I was using lots of tricks to try to squeeze every last byte out of the minified bundle size which isn't as much of a concern now. Out of curiosity, are there any parts that you feel are particularly messy at the moment? And yeah, I am familiar with strong typing. I don't think it will be too difficult to keep variable types consistent, we should just be careful with color picker props because some (e.g. |
Sorry for my late reaction, this week is just really busy. After tomorrow I will have a lot more time. We can still try to squeeze every last byte to make the package really small. I think that we can even make it smaller than the package currently is, but not much tho, maybe a really small bit. There isn't really "one" part that feels messy. The structure feels messy or something, every file for itself looks not horrible, but everything combined looks weird and messy. When I started porting, I had a log of issues, there were properties and functions coming out of nowhere. Do you mean overridden with internal logic by preact or by Iro.JS? If it is PReact, don't worry about that. If it is by Iro.JS, we can probably find a way to fix it. |
No worries! Take your time, I'm a little busy too Like the file structure itself is messy? Or the way that things are shared across files? I don't really have a computer science background or anything like that, so I suppose there may be some strange choices. I'm happy to hear any suggestions if you think there's a better way to organise it though Oh -- they're overridden by logic in iro.js. For example if the user doesn't provide a sliderHeight then it is calculated from the handle radius, padding, etc. |
To be fair, the choices aren't that bad, it is always just somebody's opinion. The file structure is not that bad, the messy parts are just the inconsistencies across the code. Ahh, but a sliderHeight will always be a variable of the type You said that a lot of things didn't change from the beginning and that you would like a cleanup. Which parts aren't that changed and really need a cleanup in your opinion? Lets discuss how we are going to clean it up, before actually cleaning it up. |
Hey, sorry again for the slow response I can see how that feels confusing, I'd support changing those to something more consistent :) Well, so far I've been using Cleanup-wise there's a couple of things:
|
Hey,
I don't know for sure how we could combine the 3 event-like systems right now. It should be possible I think. Going to look in to it to be sure. Hmm, yeah about the extending part, I see why you did it. We could change that, depends if you want it. Let me know. |
I did some research and it seems you're right, setting a typed variable to null is acceptable Typescript so long as the config How do you want to organise collaborating on this project by the way? Should I just push to your fork or should I set up a new branch here? I need to port over the new Also sorry for the slow reply, I've been throwing a lot of time and energy into this project recently and I'm starting to feel a little burnt out tbh. |
Oh hey, really sorry, I thought that you gave up on me hahah. No worries, I totally get it, I have been focusing on exams etc lately. |
Ahah, sorry about that! I've merged this into iro.js typescript branch, I had to resolve a couple of merge conflicts but feature-wise the typescript port should be identical to the latest version of iro.js now Since this is technically merged now, would you like to continue the conversation here or should we move to an issue thread or something? |
Hahah, no worries (: Yeah feature-wise it isn't 100% identical. Maybe an issue thread is better, I have an idea which should make iro.js smaller and easier to port to frameworks or even for vanillaJS |
Trying to port Iro.JS to Iro.TS (funny right?).
The first stage is make Iro.JS compileable.
After that the codebase will get improvements.
If somebody has any suggestions, just throw them at me.