Hacker News new | ask | show | jobs
by Gehinnn 2457 days ago
Also, from C# dev to C# dev, you definitely should check out TypeScript. Checks like this:

if (parent !== null && !(parent instanceof Entity)) { throw new TypeError('parent must be an Entity instance or null'); }

will be as short as

constructor(parent: Entity | null, ...)

... and entirely checked during compile/design time.

1 comments

Thank you for your help!

It actually run only on Node (but could be adapted on browser). Yes an online demo is a good idea!

I did used prettier and Xo in the past. I know I'm in the wrong but my eye are so much adapted to that C/C# style that it is way easier for me to read. For a next update/my next open-source projects, I'll think twice about it.

I have no doubt Typescript is great. I've tried use it in previous very complex projects pushing JS to limits. It had a few quircks that made it unable to use, same thing for Flow. But same thing here, I'll think about it twice next time!

Thanks!

Feel free to ping me on twitter (@hediet_dev) if you got stuck with typescript on your next project!