2
horus
1y

After some joyful years with typescript i learned that my major code base didn't use strict mode. I changed and now i feel i don't know typescript at all. Some things get irritatingly complicated now although it's even more resilient now for sure. I am not sure how to feel about it. So to the typescript out there: Do you use strict? A custom set of rules?

Comments
  • 1
    I wished i could enforce strict mode - but the code base isn't ready for it - yet. So it is just warnings for some strict checks for now (the code base is very yellow) and whenever i touch something, i make it pass the checks too.
  • 0
    @Oktokolo wich are the tylical patterns which doesn't make it ready?
  • 1
    @horus It has been built without null safety enabled and there is a lot of impicit and explicit use of the any type.
  • 0
    I have the same. It took me two days already and I think i will need two more to make it work under strict. Wonder if it's worth the hasse. The no-implicit-any rule leads to insane constructs here and there but most likely i am doing it wrong.
  • 0
    @horus If you are really sure, you can just cast an unknown to what it actually is. But beware: The transpiler won't verify whether you're right.
  • 0
    I know what you mean. I do typescript, and then take a few month break and repeat. One of this time, angular was updated and changed to strict. I had to add all this extra code. It's not very pretty.

    I'm glad for the compiler checks.

    But in retrospect thinking i have to go back to the code and rethink my variable declarations. Maybe that will pretty up my code a bit.
Add Comment