Hacker News new | past | comments | ask | show | jobs | submit login

Honest question. What do you see "not clean" in the original code?



Good question. The honest answer is that I don't know and that's the problem.

A compiler would tell me what all the types should be and if they are being respected. I'd also write a lot of unit tests to make sure that the code is doing what it is expected to as well as enable refactoring more easily. The code isn't formatted consistently, so that also makes it hard for me to read, I'm kind of OCD about that and having tools like eslint/prettier, which do it automatically, makes this super easy to fix. Linting the code would also point out other issues that the compiler misses. Putting it into CI would ensure that all changes get checked and builds would fail, if there are issues.

So I guess that is what I mean when I say 'clean it up'.


Update: Getting a lot of downvotes (yes, I know against HN 'rules' to comment about that), but I don't get why people dislike my response so much and would love feedback on that (similar to how the OP asked for honest feedback).

What I did was pull the source code, load it up in IDEA, convert the .js files to .ts files. Then looked at the errors. Most of what stood out was that the author included a copy of threejs directly and used parts that TS can't infer types on. Not a huge deal, but makes following the code more difficult for sure. I don't think it would take too much time to update it at all.


If you compiled me, you'd know that you are a type who I respect ;)

I think you're right on many counts, and I appreciate the effort you took to see what TS could do for this kind of project.

If you create an issue on the repo, I can notify you if I make an attempt at using TypeScript to maintain it, in a branch at least. No guarantees, but I've considered it before, and it'd be worth my time once I have some to allocate.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: