Essential TypeScript 4 by Adam Freeman

Essential TypeScript 4 by Adam Freeman

Author:Adam Freeman
Language: eng
Format: epub
ISBN: 9781484270110
Publisher: Apress


The application of the readonly keyword to the id property in Listing 11-11 means the value assigned by the constructor cannot be changed subsequently. The statement that attempts to assign a new value to the id property causes the following compiler error:src/index.ts(27,15): error TS2540: Cannot assign to 'id' because it is a read-only property.

Caution

The readonly keyword is enforced by the TypeScript compiler and does not affect the JavaScript code that the compiler generates. Do not use this feature to protect sensitive data or operations.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.