September 2018
Intermediate to advanced
302 pages
7h 17m
English
You may use the TypeScript linter to enforce the readonly keyword in TypeScript files. One of the open source solutions that allows you to do this is tslint-immutable.
It adds additional rules to the tslint.json configuration file:
"no-var-keyword": true,"no-let": true,"no-object-mutation": true,"no-delete": true,"no-parameter-reassignment": true,"readonly-keyword": true,"readonly-array": true,
From now on, when you run linter, you will see errors if you violate any of the preceding rules. I have refactored the code to comply with them. Check the full example in code files directory at src/Chapter_11/Example_6. To run linter, you may use the following command in the Terminal:
yarn run lint
Read now
Unlock full access