r/javascript • • May 22 '19

JavaScript Clean Code - Best Practices - based on Robert C. Martin's book Clean Code

https://devinduct.com/blogpost/22/javascript-clean-code-best-practices
542 Upvotes

112 comments sorted by

View all comments

Show parent comments

1

u/Ozymandias-X May 23 '19

But then, when I want to use the function, I now get no type hints whatsoever about what information it needs to work. All I see is that it can give it a mysterious blobby object that might have fields of some kind. Never mind if I accidentally misstype one of the keys. That's a nightmare level error to find.

This can only be solved by extensive documentation of the function and we all know that such documentation often lies when people refactor or extend functions and forget to update the docs.

1

u/[deleted] May 23 '19

Yeah just what I was thinking. With Typescript you wouldn't have that problem because it would clearly say what date you would be filling