File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -136,12 +136,13 @@ class Parser {
136
136
if ( loadedElement . $_partial ) {
137
137
return new Proxy ( instance , {
138
138
get : function ( target , prop ) {
139
- if ( prop in target ) {
140
- return target [ prop ] ;
141
- }
142
139
if ( prop === "$_partial" ) {
143
140
return true ;
144
141
}
142
+ if ( prop in target ) {
143
+ debug ( 'warn' , `Trying to call property ${ prop . toString ( ) } to a model that is not included ("${ loadedElement . type } "). Maybe you mean't to include it?` ) ;
144
+ return target [ prop ] ;
145
+ }
145
146
debug ( 'error' , `Trying to call property "${ prop . toString ( ) } " to a model that is not included. Add "${ loadedElement . type } " to included models.` ) ;
146
147
return undefined ;
147
148
}
Original file line number Diff line number Diff line change @@ -132,12 +132,13 @@ class Parser {
132
132
if ( loadedElement . $_partial ) {
133
133
return new Proxy ( instance , {
134
134
get : function ( target , prop ) {
135
- if ( prop in target ) {
136
- return target [ prop ] ;
137
- }
138
135
if ( prop === "$_partial" ) {
139
136
return true ;
140
137
}
138
+ if ( prop in target ) {
139
+ debug ( 'warn' , `Trying to call property ${ prop . toString ( ) } to a model that is not included ("${ loadedElement . type } "). Maybe you mean't to include it?` ) ;
140
+ return target [ prop ] ;
141
+ }
141
142
debug ( 'error' , `Trying to call property "${ prop . toString ( ) } " to a model that is not included. Add "${ loadedElement . type } " to included models.` ) ;
142
143
return undefined ;
143
144
}
Original file line number Diff line number Diff line change @@ -91,12 +91,13 @@ export class Parser {
91
91
instance ,
92
92
{
93
93
get : function < T extends object > ( target : T , prop : keyof T ) {
94
- if ( prop in target ) {
95
- return target [ prop ] ;
96
- }
97
94
if ( prop === "$_partial" ) {
98
95
return true ;
99
96
}
97
+ if ( prop in target ) {
98
+ debug ( 'warn' , `Trying to call property ${ prop . toString ( ) } to a model that is not included ("${ loadedElement . type } "). Maybe you mean't to include it?` ) ;
99
+ return target [ prop ] ;
100
+ }
100
101
debug ( 'error' , `Trying to call property "${ prop . toString ( ) } " to a model that is not included. Add "${ loadedElement . type } " to included models.` ) ;
101
102
return undefined ;
102
103
} ,
You can’t perform that action at this time.
0 commit comments