File tree Expand file tree Collapse file tree 2 files changed +36
-16
lines changed
Expand file tree Collapse file tree 2 files changed +36
-16
lines changed Original file line number Diff line number Diff line change 2323 "lint" : " run-p \" lint:*\" " ,
2424 "lint:eslint" : " eslint" ,
2525 "lint:prettier" : " prettier --check ." ,
26+ "lint:tsc" : " tsc --noEmit" ,
2627 "fix" : " run-s \" fix:*\" " ,
2728 "fix:eslint" : " yarn lint:eslint --fix" ,
2829 "fix:prettier" : " yarn lint:prettier --write" ,
Original file line number Diff line number Diff line change @@ -94,23 +94,42 @@ class Transformer extends Source {
9494 }
9595 const object = this . #transform< babel . Expression > ( receiver ) ;
9696 const isOptionalObject = isOptionalObjectOrCallee ( object ) ;
97- return this . #create<
98- babel . OptionalMemberExpression | babel . MemberExpression
99- > (
97+
98+ const commonProps = {
99+ property,
100+ object,
101+ computed,
102+ ...node . sourceSpan ,
103+ } ;
104+
105+ if ( optional || isOptionalObject ) {
106+ return this . #create< babel . OptionalMemberExpression > (
107+ {
108+ type : 'OptionalMemberExpression' ,
109+ optional : optional || ! isOptionalObject ,
110+ ...commonProps ,
111+ } ,
112+ { hasParentParens } ,
113+ ) ;
114+ }
115+
116+ if ( computed ) {
117+ return this . #create< babel . MemberExpressionComputed > (
118+ {
119+ type : 'MemberExpression' ,
120+ ...commonProps ,
121+ computed : true ,
122+ } ,
123+ { hasParentParens } ,
124+ ) ;
125+ }
126+
127+ return this . #create< babel . MemberExpressionNonComputed > (
100128 {
101- type :
102- optional || isOptionalObject
103- ? 'OptionalMemberExpression'
104- : 'MemberExpression' ,
105- object,
106- property,
107- computed : computed ,
108- ...( optional
109- ? { optional : true }
110- : isOptionalObject
111- ? { optional : false }
112- : undefined ) ,
113- ...node . sourceSpan ,
129+ type : 'MemberExpression' ,
130+ ...commonProps ,
131+ computed : false ,
132+ property : property as babel . MemberExpressionNonComputed [ 'property' ] ,
114133 } ,
115134 { hasParentParens } ,
116135 ) ;
You can’t perform that action at this time.
0 commit comments