Thursday, July 20, 2017

TypeScript can enforce code correctness is so awesome

Following is a compile-time error:



To correct that, use 'onClick' not 'onclick':




Checked the TypeScript definition of prop function:




Don't know yet how extends keyof works. One thing for sure, it truly helps developers avoid mistakes.


Happy Coding!

No comments:

Post a Comment