提交 1785081e 编写于 作者: 1 100pah

fix: clarify comments.

上级 95e9b271
...@@ -47,11 +47,15 @@ const inner = makeInner<{ ...@@ -47,11 +47,15 @@ const inner = makeInner<{
class ComponentModel<Opt extends ComponentOption = ComponentOption> extends Model<Opt> { class ComponentModel<Opt extends ComponentOption = ComponentOption> extends Model<Opt> {
// [Caution]: for compat the previous "class extend" // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,
// publich and protected fields must be initialized on // the class members must not be initialized in constructor or declaration place.
// prototype rather than in constructor. Otherwise the // Otherwise there is bad case:
// subclass overrided filed will be overwritten by this // class A {xxx = 1;}
// class. That is, they should not be initialized here. // enableClassExtend(A);
// class B extends A {}
// var C = B.extend({xxx: 5});
// var c = new C();
// console.log(c.xxx); // expect 5 but always 1.
/** /**
* @readonly * @readonly
......
...@@ -46,11 +46,15 @@ type Value<Opt, R> = Opt extends Dictionary<any> ...@@ -46,11 +46,15 @@ type Value<Opt, R> = Opt extends Dictionary<any>
class Model<Opt extends ModelOption = ModelOption> { // TODO: TYPE use unkown insteadof any? class Model<Opt extends ModelOption = ModelOption> { // TODO: TYPE use unkown insteadof any?
// [Caution]: for compat the previous "class extend" // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,
// publich and protected fields must be initialized on // the class members must not be initialized in constructor or declaration place.
// prototype rather than in constructor. Otherwise the // Otherwise there is bad case:
// subclass overrided filed will be overwritten by this // class A {xxx = 1;}
// class. That is, they should not be initialized here. // enableClassExtend(A);
// class B extends A {}
// var C = B.extend({xxx: 5});
// var c = new C();
// console.log(c.xxx); // expect 5 but always 1.
/** /**
* @readOnly * @readOnly
......
...@@ -109,11 +109,15 @@ interface SeriesModel { ...@@ -109,11 +109,15 @@ interface SeriesModel {
class SeriesModel<Opt extends SeriesOption = SeriesOption> extends ComponentModel<Opt> { class SeriesModel<Opt extends SeriesOption = SeriesOption> extends ComponentModel<Opt> {
// [Caution]: for compat the previous "class extend" // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,
// publich and protected fields must be initialized on // the class members must not be initialized in constructor or declaration place.
// prototype rather than in constructor. Otherwise the // Otherwise there is bad case:
// subclass overrided filed will be overwritten by this // class A {xxx = 1;}
// class. That is, they should not be initialized here. // enableClassExtend(A);
// class B extends A {}
// var C = B.extend({xxx: 5});
// var c = new C();
// console.log(c.xxx); // expect 5 but always 1.
// @readonly // @readonly
type: string; type: string;
......
...@@ -95,11 +95,15 @@ interface ChartView { ...@@ -95,11 +95,15 @@ interface ChartView {
} }
class ChartView { class ChartView {
// [Caution]: for compat the previous "class extend" // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,
// publich and protected fields must be initialized on // the class members must not be initialized in constructor or declaration place.
// prototype rather than in constructor. Otherwise the // Otherwise there is bad case:
// subclass overrided filed will be overwritten by this // class A {xxx = 1;}
// class. That is, they should not be initialized here. // enableClassExtend(A);
// class B extends A {}
// var C = B.extend({xxx: 5});
// var c = new C();
// console.log(c.xxx); // expect 5 but always 1.
// @readonly // @readonly
type: string; type: string;
......
...@@ -45,11 +45,15 @@ interface ComponentView { ...@@ -45,11 +45,15 @@ interface ComponentView {
class ComponentView { class ComponentView {
// [Caution]: for compat the previous "class extend" // [Caution]: Becuase this class or desecendants can be used as `XXX.extend(subProto)`,
// publich and protected fields must be initialized on // the class members must not be initialized in constructor or declaration place.
// prototype rather than in constructor. Otherwise the // Otherwise there is bad case:
// subclass overrided filed will be overwritten by this // class A {xxx = 1;}
// class. That is, they should not be initialized here. // enableClassExtend(A);
// class B extends A {}
// var C = B.extend({xxx: 5});
// var c = new C();
// console.log(c.xxx); // expect 5 but always 1.
readonly group: ViewRootGroup; readonly group: ViewRootGroup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册