54 lines
910 B
Plaintext

include::../why.adoc[]
include::../how.adoc[]
=== Code examples
==== Noncompliant code example
[source,javascript,diff-id=1,diff-type=noncompliant]
----
class Person {
private birthYear: number; // Noncompliant
constructor(birthYear: number) {
this.birthYear = birthYear;
}
}
----
==== Compliant solution
[source,javascript,diff-id=1,diff-type=compliant]
----
class Person {
private readonly birthYear: number;
constructor(birthYear: number) {
this.birthYear = birthYear;
}
}
----
== Resources
=== Documentation
* TypeScript Documentation - https://www.typescriptlang.org/docs/handbook/2/classes.html#readonly[readonly]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]