File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed
Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ export class Computed<C extends { [K: string]: () => any } = any> {
5858 } ;
5959
6060 constructor ( context : Context , public computed : C ) {
61+ if ( "setData" in computed ) {
62+ throw new Error ( `can not be used [setData] as key` ) ;
63+ }
6164 for ( const key in computed ) {
6265 if ( key in context . data . state ) {
6366 throw new Error ( `"data" and "computed" has the same key:[${ key } ]` ) ;
Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ export class Data<D = any> {
1717 } ;
1818
1919 constructor ( context : Context , public data : D ) {
20+ if ( "setData" in data ) {
21+ throw new Error ( `can not be used [setData] as key` ) ;
22+ }
2023 for ( const key in data ) {
2124 this . state [ key ] = new DataState ( data [ key ] ) ;
2225 }
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ export class Methods<M extends { [K: string]: (...args: any[]) => any } = any> {
2020 func = { } as { [ K : string ] : ( ...args : any [ ] ) => any } ;
2121
2222 constructor ( private context : Context , public methods : M ) {
23+ if ( "setData" in methods ) {
24+ throw new Error ( `can not be used [setData] as key` ) ;
25+ }
2326 for ( const key in methods ) {
2427 if ( key in context . data . state || key in context . computed . state ) {
2528 throw new Error (
You can’t perform that action at this time.
0 commit comments