Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To address culture, someone has to start doing it better, no reason it can't be those who know there is a better way, so I treat that as a red herring myself. You could always make a strongly typed wrapper around a library, for instance.

Creating type guards might be a pain, sure. I think assertion functions will go a long way in this regard

https://www.typescriptlang.org/docs/handbook/release-notes/t...

I also think that its an overestimated pain. If you are using interfaces to type your objects (commonly, this seems to be the pain point) then I don't think its terribly difficult to construct type guards around that.

There is also the reflect-metadata polyfill (that I think TC39 is eventually going to make a standard) for run time type information. Using decorators could be valuable combined with `emitDecoratorMetadata` option

https://rbuckton.github.io/reflect-metadata/



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

Search: