Which writes to these readonly properties does TypeScript reject, and what does the code log?
Name the type the ^? line points at, every error TypeScript reports, and what the code logs when you run it with its types removed.
class Config { readonly url: string; readonly retries = 3; readonly tags: string[] = []; constructor(url: string) { this.url = url; } reset() { this.retries = 0; }} const config = new Config("/api");config.tags.push("beta");config.url = "/v2";console.log(config.url, config.tags); const retries = config.retries;// ^?Work it out first: the compiler shows every error and type.
The answer
Work out every error TypeScript reports and every type it shows, line by line. Then check.
Checking your sign-in…