readonly
JS-0368readonly
110 * Convert placeholders symbols from the configuration settings.
111 */
112export class PlaceholdersConverter {
113 private data: DataModel;114 public statement: string;
115
116 /**
readonly
11}
12
13export class Config {
14 private config: IConfiguration;15
16 constructor(configurations: IConfiguration) {
17 this.config = configurations;
Private members are marked as readonly
if they're never modified outside of the constructor.
class Container {
// These member variables could be marked as readonly
private neverModifiedMember = true;
private onlyModifiedInConstructor: number;
public constructor(
onlyModifiedInConstructor: number,
// Private parameter properties can also be marked as readonly
private neverModifiedParameter: string,
) {
this.onlyModifiedInConstructor = onlyModifiedInConstructor;
}
}
class Container {
// Public members might be modified externally
public publicMember: boolean;
// Protected members might be modified by child classes
protected protectedMember: number;
// This is modified later on by the class
private modifiedLater = 'unchanged';
public mutate() {
this.modifiedLater = 'mutated';
}
}