We are going to start refactoring our CountDisplay component. It is a small stateless component but it has a few props that can benefit from type safety.
There are three ways to type a component, in ...……
通过 getters/setters 来截取对对象成员的访问
class Person {
private _age: number = 0;
set age(val: number) {
console.log('进入了set age方法');
if (val amp;amp;lt; 0) {
...……