]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix: defineExpose type definition and runtime warning
authorEvan You <yyx990803@gmail.com>
Fri, 25 Jun 2021 20:18:21 +0000 (16:18 -0400)
committerEvan You <yyx990803@gmail.com>
Fri, 25 Jun 2021 20:18:21 +0000 (16:18 -0400)
packages/runtime-core/src/apiSetupHelpers.ts

index 4679df90193fe13c04bbd846903dfa43448d08b7..c1703f2233337055e00b624cc910c0abec187c91 100644 (file)
@@ -61,6 +61,16 @@ export function defineEmits() {
  */
 export const defineEmit = defineEmits
 
+export function defineExpose(exposed?: Record<string, any>) {
+  if (__DEV__) {
+    warn(
+      `defineExpose() is a compiler-hint helper that is only usable inside ` +
+        `<script setup> of a single file component. Its usage should be ` +
+        `compiled away and calling it at runtime has no effect.`
+    )
+  }
+}
+
 /**
  * @deprecated use `useSlots` and `useAttrs` instead.
  */