Skip to content

Commit

Permalink
types: fix global helpers dts generation
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 27, 2021
1 parent fddef8b commit ef5c415
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
19 changes: 0 additions & 19 deletions packages/runtime-core/src/apiSetupHelpers.ts
Expand Up @@ -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(
Expand Down
13 changes: 13 additions & 0 deletions packages/runtime-core/types/scriptSetupHelpers.d.ts
@@ -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
}

0 comments on commit ef5c415

Please sign in to comment.