From cd42f62fb906a225569e780631662ebfbec671d5 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 21 Jan 2022 09:51:19 +0000 Subject: [PATCH] fix(nuxt3): export composable types (#2828) --- packages/nuxt3/src/app/composables/index.ts | 6 +++--- packages/nuxt3/test/auto-imports.test.ts | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/nuxt3/src/app/composables/index.ts b/packages/nuxt3/src/app/composables/index.ts index b69f7b3160..242e738930 100644 --- a/packages/nuxt3/src/app/composables/index.ts +++ b/packages/nuxt3/src/app/composables/index.ts @@ -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' diff --git a/packages/nuxt3/test/auto-imports.test.ts b/packages/nuxt3/test/auto-imports.test.ts index 4481da4325..9214814437 100644 --- a/packages/nuxt3/test/auto-imports.test.ts +++ b/packages/nuxt3/test/auto-imports.test.ts @@ -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`, () => {