mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
test: add type test for nuxt module resolved types
This commit is contained in:
parent
41fc45da25
commit
115fc2d18f
12
test/fixtures/basic-types/types.ts
vendored
12
test/fixtures/basic-types/types.ts
vendored
@ -4,6 +4,7 @@ import type { FetchError } from 'ofetch'
|
||||
import type { NavigationFailure, RouteLocationNormalized, RouteLocationRaw, Router, useRouter as vueUseRouter } from '#vue-router'
|
||||
|
||||
import type { AppConfig, RuntimeValue, UpperSnakeCase } from 'nuxt/schema'
|
||||
import { defineNuxtModule } from 'nuxt/kit'
|
||||
import { defineNuxtConfig } from 'nuxt/config'
|
||||
import { callWithNuxt, isVue3 } from '#app'
|
||||
import type { NuxtError } from '#app'
|
||||
@ -242,6 +243,17 @@ describe('modules', () => {
|
||||
// @ts-expect-error we want to ensure we throw type error on invalid key
|
||||
defineNuxtConfig({ undeclaredKey: { other: false } })
|
||||
})
|
||||
|
||||
it('preserves options in defineNuxtModule setup without `.with()`', () => {
|
||||
defineNuxtModule<{ foo?: string, baz: number }>({
|
||||
defaults: {
|
||||
baz: 100,
|
||||
},
|
||||
setup: (resolvedOptions) => {
|
||||
expectTypeOf(resolvedOptions).toEqualTypeOf<{ foo?: string, baz: number }>()
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('nuxtApp', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user