Conversation
|
Should you change the language of the snippet? ```javascript
function wrong() { }
``` ```typescript
function fixed() { }
``` |
|
Hey there! I've gone back and forth about this. Should this show TypeScript code at all? Since this repo is focused just on JavaScript I would prefer to keep it solely JavaScript. The subsection in question is regarding the avoidance of runtime type checks in JS, and advocates using a typed alternative. Is the advocacy enough? I welcome comments :) |
|
This is the description before the code snippet.
It seems like the best way to show the "bad" and "good" is to show how to convert a run-time type check to a compile-time type check. Maybe you could add a link to the TypeScript Playground so it's a little easier to see why this is valuable. |
|
And now that I look at the original JS code, I think this is not easily type checked using TypeScript since the js example requires both param types to be the same. You could add a |
|
To me the subsection suggested that the good was going to be an example of TypeScript. What if there was another |
I wasn't aware there was support for for typescript. I can change that |
|
Every subsection should have just one I'm totally open to hearing a convincing argument, but as it is I'm not too sure about including another language in an example other than simply saying "go check this superset of JS if you want type-checking" |
|
#221 (comment) that being said, we should close this PR! Right? |
|
Looks like there's now a TypeScript clean code project, see here: https://github.com/labs42io/clean-code-typescript |
Fixed the example to show usage of typescript. Also that same example works if you want to promote the usage of Flow