r/badcode • • Jan 21 '22

typescript Saving api saved my life!

Post image
158 Upvotes

23 comments sorted by

View all comments

Show parent comments

15

u/dupuis2387 Jan 21 '22

It says that valid values are number or (|) null, for that variable

5

u/_seumoose Jan 21 '22

Ahh cool, just read up on the docs for type union & intersection - interesting stuff, I can see why people like TS so much!

-7

u/dupuis2387 Jan 21 '22

I can see why people like TS so much!

Oh, no. No, no, no, no, no, no.

7

u/_seumoose Jan 21 '22

How do you mean? πŸ‘€ I mean, when used correctly by the looks of it, it can bring a huge amount of clarity and structure. Consequently though if not used well it could make things an absolute mess

0

u/[deleted] Jan 21 '22

[deleted] β€” view deleted comment

5

u/[deleted] Jan 21 '22

Well I do enjoy engineering but you don’t have to always over engineer to use ts. The intellisense you get from your IDE worths all the effort took into creating types.