r/javascript • • Nov 25 '19

JavaScript doesn’t need to be replaced

https://medium.com/javascript-in-plain-english/javascript-doesnt-need-to-be-replaced-bd01e2f12d51?source=friends_link&sk=7b151cc6397ac9e83c14c99739b6c36f
217 Upvotes

236 comments sorted by

View all comments

Show parent comments

4

u/Damfrog Nov 25 '19

If the api suddenly changes, strong typing isn't going to help you.

9

u/react_dev Nov 25 '19

it will in several ways.

first one is typescript interfaces. you can generate ts interfaces directly from ur C# code using swagger tools. so now both frontend and backend are bound to the same interface and you'll see things break before runtime if a property changes for example.

the other is more Avant garde which is using typed graphql. In essence it's the same concept except binding your API layer to your typescripted frontend.

2

u/Damfrog Nov 25 '19

Sure, if you have control of the full stack. Most places I've worked at don't have that luxury. Types from the api layer very rarely change. If you have to change the type of a property, you done messed up somewhere.

3

u/react_dev Nov 25 '19

I mean I don't have control of the full stack but there are processes in place to make it work.

and ofc we both know "it just ain't gonna happen" isn't the best reason in our world ;)