“TypeScript Convert Readonly” Réponses codées

TypeScript Convert Readonly

type DeepWriteable<T> = { -readonly [P in keyof T]: DeepWriteable<T[P]> };
florinrelea

TypeScript Readonly

class Octopus {  readonly name: string;  readonly numberOfLegs: number = 8;
  constructor(theName: string) {    this.name = theName;  }}
let dad = new Octopus("Man with the 8 strong legs");dad.name = "Man with the 3-piece suit";Cannot assign to 'name' because it is a read-only property.2540Cannot assign to 'name' because it is a read-only property.Try
Bewildered Bear

Réponses similaires à “TypeScript Convert Readonly”

Questions similaires à “TypeScript Convert Readonly”

Plus de réponses similaires à “TypeScript Convert Readonly” dans TypeScript

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code