浏览代码

fix: defineExpose type definition and runtime warning

Evan You 5 年之前
父节点
当前提交
1675b6d723
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      packages/runtime-core/src/apiSetupHelpers.ts

+ 10 - 0
packages/runtime-core/src/apiSetupHelpers.ts

@@ -61,6 +61,16 @@ export function defineEmits() {
  */
  */
 export const defineEmit = 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.
  * @deprecated use `useSlots` and `useAttrs` instead.
  */
  */