File tree 1 file changed +42
-0
lines changed
packages/compiler-sfc/__tests__
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,48 @@ defineOptions({ name: 'FooApp' })
262
262
'[@vue/compiler-sfc] defineOptions() cannot accept type arguments'
263
263
)
264
264
} )
265
+
266
+ it ( 'should emit an error with declaring props/emits/slots/expose' , ( ) => {
267
+ expect ( ( ) =>
268
+ compile ( `
269
+ <script setup>
270
+ defineOptions({ props: ['foo'] })
271
+ </script>
272
+ ` )
273
+ ) . toThrowError (
274
+ '[@vue/compiler-sfc] defineOptions() cannot be used to declare props. Use defineProps() instead'
275
+ )
276
+
277
+ expect ( ( ) =>
278
+ compile ( `
279
+ <script setup>
280
+ defineOptions({ emits: ['update'] })
281
+ </script>
282
+ ` )
283
+ ) . toThrowError (
284
+ '[@vue/compiler-sfc] defineOptions() cannot be used to declare emits. Use defineEmits() instead'
285
+ )
286
+
287
+ expect ( ( ) =>
288
+ compile ( `
289
+ <script setup>
290
+ defineOptions({ expose: ['foo'] })
291
+ </script>
292
+ ` )
293
+ ) . toThrowError (
294
+ '[@vue/compiler-sfc] defineOptions() cannot be used to declare expose. Use defineExpose() instead'
295
+ )
296
+
297
+ expect ( ( ) =>
298
+ compile ( `
299
+ <script setup lang="ts">
300
+ defineOptions({ slots: Object })
301
+ </script>
302
+ ` )
303
+ ) . toThrowError (
304
+ '[@vue/compiler-sfc] defineOptions() cannot be used to declare slots. Use defineSlots() instead'
305
+ )
306
+ } )
265
307
} )
266
308
267
309
test ( 'defineExpose()' , ( ) => {
You can’t perform that action at this time.
0 commit comments