]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types: fix global helpers dts generation
authorEvan You <yyx990803@gmail.com>
Sun, 27 Jun 2021 01:47:18 +0000 (21:47 -0400)
committerEvan You <yyx990803@gmail.com>
Sun, 27 Jun 2021 01:47:18 +0000 (21:47 -0400)
packages/runtime-core/src/apiSetupHelpers.ts
packages/runtime-core/types/scriptSetupHelpers.d.ts [new file with mode: 0644]

index 5f613ec21229a376a60c6a1712301f3636912d08..493cb71395991c478a6390d7753d425a50de1d44 100644 (file)
@@ -11,25 +11,6 @@ import {
 } from './componentProps'
 import { warn } from './warning'
 
-/**
- * The following helpers are compiler macros that are only usable inside
- * `<script setup>`. They are essentially part of the `<script setup>` API and
- * will be frequently used. Although they can be explicitly imported, they can
- * actually be used directly inside `<script setup>` blocks. Their types are
- * therefore also made globally available to ensure proper type inference.
- */
-type _defineProps = typeof defineProps
-type _defineEmits = typeof defineEmits
-type _defineExpose = typeof defineExpose
-type _withDefaults = typeof withDefaults
-
-declare global {
-  const defineProps: _defineProps
-  const defineEmits: _defineEmits
-  const defineExpose: _defineExpose
-  const withDefaults: _withDefaults
-}
-
 // dev only
 const warnRuntimeUsage = (method: string) =>
   warn(
diff --git a/packages/runtime-core/types/scriptSetupHelpers.d.ts b/packages/runtime-core/types/scriptSetupHelpers.d.ts
new file mode 100644 (file)
index 0000000..4d16821
--- /dev/null
@@ -0,0 +1,13 @@
+// Note: this file is auto concatenated to the end of the bundled d.ts during
+// build.
+type _defineProps = typeof defineProps
+type _defineEmits = typeof defineEmits
+type _defineExpose = typeof defineExpose
+type _withDefaults = typeof withDefaults
+
+declare global {
+  const defineProps: _defineProps
+  const defineEmits: _defineEmits
+  const defineExpose: _defineExpose
+  const withDefaults: _withDefaults
+}