fix(nuxt3): export composable types (#2828)

This commit is contained in:
Daniel Roe 2022-01-21 09:51:19 +00:00 committed by GitHub
parent 9660cd8212
commit cd42f62fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -1,7 +1,7 @@
export { defineNuxtComponent } from './component'
export { useAsyncData, useLazyAsyncData } from './asyncData'
export { AsyncDataOptions, AsyncData, useAsyncData, useLazyAsyncData } from './asyncData'
export { useHydration } from './hydrate'
export { useState } from './state'
export { useFetch, useLazyFetch } from './fetch'
export { useCookie } from './cookie'
export { FetchResult, UseFetchOptions, useFetch, useLazyFetch } from './fetch'
export { CookieOptions, CookieRef, useCookie } from './cookie'
export { useRequestHeaders } from './ssr'

View File

@ -53,6 +53,15 @@ describe('auto-imports:transform', () => {
const excludedNuxtHelpers = ['useHydration']
const typeExports = [
'AsyncDataOptions',
'AsyncData',
'FetchResult',
'UseFetchOptions',
'CookieOptions',
'CookieRef'
]
describe('auto-imports:nuxt3', () => {
try {
const { __dirname } = createCommonJS(import.meta.url)
@ -60,7 +69,7 @@ describe('auto-imports:nuxt3', () => {
const names = findExports(entrypointContents).flatMap(i => i.names || i.name)
for (const name of names) {
if (excludedNuxtHelpers.includes(name)) {
if (excludedNuxtHelpers.includes(name) || typeExports.includes(name)) {
continue
}
it(`should register ${name} globally`, () => {