| ▲ | culi a day ago | |||||||||||||||||||||||||
Because AirBnB's ESLint config has been burned into my brain I almost only use arrow functions. I also use generics extremely often. It's definitely a little more clunky but I haven't run into anything you can do in TypeScript that you can't do in JSDoc. JSDoc also allows you to type stuff in-line. For example I often have to type an empty array like so:
If you have a tangible example of a problem you've run into, I'd love to walk through it. | ||||||||||||||||||||||||||
| ▲ | g947o a day ago | parent [-] | |||||||||||||||||||||||||
JavaScript example: https://www.typescriptlang.org/play/?filetype=js#code/PTAEAE... Almost equivalent typescript code: https://www.typescriptlang.org/play/?#code/C4TwDgpgBA6glsAFg... (I had to make it a little bit different from the JS code to make it compile) (Well, this is not exactly about arrow function I guess. I remembered that part wrong.) Note that I cannot make the type check in JS code to pass. Whatever I do, there is always a error. Meanwhile, it does not take much to TS code to work. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||