Skip to content

Commit 115fc2d

Browse files
committed
test: add type test for nuxt module resolved types
1 parent 41fc45d commit 115fc2d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/fixtures/basic-types/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { FetchError } from 'ofetch'
44
import type { NavigationFailure, RouteLocationNormalized, RouteLocationRaw, Router, useRouter as vueUseRouter } from '#vue-router'
55

66
import type { AppConfig, RuntimeValue, UpperSnakeCase } from 'nuxt/schema'
7+
import { defineNuxtModule } from 'nuxt/kit'
78
import { defineNuxtConfig } from 'nuxt/config'
89
import { callWithNuxt, isVue3 } from '#app'
910
import type { NuxtError } from '#app'
@@ -242,6 +243,17 @@ describe('modules', () => {
242243
// @ts-expect-error we want to ensure we throw type error on invalid key
243244
defineNuxtConfig({ undeclaredKey: { other: false } })
244245
})
246+
247+
it('preserves options in defineNuxtModule setup without `.with()`', () => {
248+
defineNuxtModule<{ foo?: string, baz: number }>({
249+
defaults: {
250+
baz: 100,
251+
},
252+
setup: (resolvedOptions) => {
253+
expectTypeOf(resolvedOptions).toEqualTypeOf<{ foo?: string, baz: number }>()
254+
},
255+
})
256+
})
245257
})
246258

247259
describe('nuxtApp', () => {

0 commit comments

Comments
 (0)