How to Write Clean TypeScript Code
8 knowledge points to write elegant TypeScript code.
Published in
5 min readMar 19, 2022
1. Mark with immutable types
There are constants that we don’t want to be modified in any way, and while the const keyword is nice, it doesn’t restrict the reference type and its value can still be modified, for example:
const obj = {
elementId…