This repository was archived by the owner on Dec 25, 2024. It is now read-only.
File tree 3 files changed +22
-8
lines changed
3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,9 @@ export function getIdentifierUsages(node?: Expression | TSType | SpreadElement |
70
70
else if ( node . type === 'MemberExpression' ) {
71
71
getIdentifierUsages ( node . object , identifiers )
72
72
}
73
+ else if ( node . type === 'OptionalMemberExpression' ) {
74
+ getIdentifierUsages ( node . object , identifiers )
75
+ }
73
76
else if ( node . type === 'CallExpression' ) {
74
77
getIdentifierUsages ( node . callee as Expression , identifiers )
75
78
node . arguments . forEach ( arg => getIdentifierUsages ( arg as Expression , identifiers ) )
Original file line number Diff line number Diff line change @@ -251,17 +251,23 @@ export default __sfc_main;
251
251
252
252
exports[`transform fixtures test/fixtures/MacrosDefineExpose.vue 1`] = `
253
253
" <template>
254
- <div>{{a}}</div>
254
+ <div>{{ a }}</div>
255
+ <div>{{ text?.length ?? textLengthDefault }}</div>
255
256
</template>
256
257
257
- <script lang =\\"js\\">
258
+ <script lang =\\"ts\\">
259
+ import { ref } from ' @vue/composition-api' ;
258
260
const __sfc_main = { } ;
259
261
260
262
__sfc_main.setup = (__props, __ctx) => {
261
263
const a = ref (1 );
262
264
const b = 1 ;
265
+ const text = ' hello' ;
266
+ const textLengthDefault = 0 ;
263
267
return Object .assign ({
264
- a
268
+ a ,
269
+ text ,
270
+ textLengthDefault
265
271
}, {
266
272
b
267
273
});
Original file line number Diff line number Diff line change 1
1
<template >
2
- <div >{{a}}</div >
2
+ <div >{{ a }}</div >
3
+ <div >{{ text?.length ?? textLengthDefault }}</div >
3
4
</template >
4
5
5
- <script setup lang="js">
6
- const a = ref (1 );
7
- const b = 1 ;
8
- defineExpose ({b});
6
+ <script setup lang="ts">
7
+ import { ref } from ' @vue/composition-api'
8
+
9
+ const a = ref (1 )
10
+ const b = 1
11
+ const text = ' hello'
12
+ const textLengthDefault = 0
13
+ defineExpose ({ b })
9
14
</script >
You can’t perform that action at this time.
0 commit comments