File tree 2 files changed +3
-5
lines changed
2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,6 @@ describe('isMemberExpression', () => {
105
105
expect ( fn ( 'objfoo]' ) ) . toBe ( false )
106
106
expect ( fn ( 'obj[arr[0]' ) ) . toBe ( false )
107
107
expect ( fn ( 'obj[arr0]]' ) ) . toBe ( false )
108
- expect ( fn ( '123[a]' ) ) . toBe ( false )
109
108
expect ( fn ( 'a + b' ) ) . toBe ( false )
110
109
expect ( fn ( 'foo()' ) ) . toBe ( false )
111
110
expect ( fn ( 'a?b:c' ) ) . toBe ( false )
@@ -114,6 +113,7 @@ describe('isMemberExpression', () => {
114
113
115
114
test ( 'browser' , ( ) => {
116
115
commonAssertions ( isMemberExpressionBrowser )
116
+ expect ( isMemberExpressionBrowser ( '123[a]' ) ) . toBe ( false )
117
117
} )
118
118
119
119
test ( 'node' , ( ) => {
@@ -126,6 +126,8 @@ describe('isMemberExpression', () => {
126
126
expect ( fn ( `foo.bar as string` ) ) . toBe ( true )
127
127
expect ( fn ( `foo['bar'] as string` ) ) . toBe ( true )
128
128
expect ( fn ( `foo[bar as string]` ) ) . toBe ( true )
129
+ expect ( fn ( `(foo as string)` ) ) . toBe ( true )
130
+ expect ( fn ( `123[a]` ) ) . toBe ( true )
129
131
expect ( fn ( `foo() as string` ) ) . toBe ( false )
130
132
expect ( fn ( `a + b as string` ) ) . toBe ( false )
131
133
} )
Original file line number Diff line number Diff line change @@ -165,10 +165,6 @@ export const isMemberExpressionNode = (
165
165
path : string ,
166
166
context : TransformContext
167
167
) : boolean => {
168
- path = path . trim ( )
169
- if ( ! validFirstIdentCharRE . test ( path [ 0 ] ) ) {
170
- return false
171
- }
172
168
try {
173
169
let ret : Expression = parseExpression ( path , {
174
170
plugins : [ ...context . expressionPlugins , ...babelParserDefaultPlugins ]
You can’t perform that action at this time.
0 commit comments