microsoft / TypeScript-Handbook

Deprecated, please use the TypeScript-Website repo instead
https://github.com/microsoft/TypeScript-Website
Apache License 2.0
4.88k stars 1.13k forks source link

Add readonly for React Props interface #1322

Closed xiaoxiangmoe closed 4 years ago

xiaoxiangmoe commented 4 years ago

see https://reactjs.org/docs/components-and-props.html#props-are-read-only

orta commented 4 years ago

Yeah, that seems like a good call 👍

swyxio commented 4 years ago

fwiw i think a year ago @ferdaber said that the readonly is going to be applied from the @types/react side - not sure if that actually happened

ferdaber commented 4 years ago

For class components I believe they are already read only.

xiaoxiangmoe commented 4 years ago

For function component, readonly is needed.

What should I do now?

ferdaber commented 4 years ago

this PR is probably fine as-is, the updates on the React typings side can come later.

orta commented 4 years ago

I'm not merging any PRs on this repo (content is frozen in preparation for archiving - see #1313) but when we flip the switch, I'll port over PRs to the v2 site

So for now, you can do nothing

orta commented 4 years ago

These two tutorials now redirect to the typescript pages on the tool's side - so I can't reapply any of this to the v2 site. Thanks for the PR though!