fix(types): improve with strict mode (#1041)

This commit is contained in:
Benjamin Canac
2023-11-30 12:02:37 +01:00
committed by GitHub
parent 464ff0b703
commit 4a9b66aeb3
68 changed files with 266 additions and 242 deletions

View File

@@ -5,13 +5,13 @@ import { join } from 'path'
// TODO: fix these anys
async function getTailwindCSSConfig (overrides: any = {}): Promise<[any, any]> {
overrides.modules = [ module ]
overrides.modules = [module]
overrides.ssr = overrides.ssr ?? false
overrides.hooks = overrides.hooks ?? {}
return new Promise((resolve) => {
overrides.hooks['tailwindcss:resolvedConfig'] = async (config) => {
resolve([config, nuxt])
}
overrides.hooks['tailwindcss:resolvedConfig'] = async (config: any) => {
resolve([config, nuxt])
}
const nuxt = loadNuxt({
cwd: join(process.cwd(), 'fixtures', 'empty'),
dev: false,
@@ -23,7 +23,7 @@ async function getTailwindCSSConfig (overrides: any = {}): Promise<[any, any]> {
describe('nuxt', () => {
it('should add plugins and modules to nuxt', async () => {
const [, lnuxt] = await getTailwindCSSConfig()
await lnuxt.then((nuxt) => {
await lnuxt.then((nuxt: { options: { plugins: any; _requiredModules: any; appConfig: { ui: any } }; close: () => void }) => {
expect(nuxt.options.plugins).toContainEqual(
expect.objectContaining({
src: expect.stringContaining('plugins/colors'),
@@ -116,7 +116,7 @@ describe('tailwindcss config', () => {
negate = false
}
await _nuxt.then((n) => {
await _nuxt.then((n: { close: () => void }) => {
n.close()
})
})

View File

@@ -13,6 +13,7 @@ describe('Button', () => {
[ 'black solid', { props: { color: 'black', variant: 'solid' } } ],
[ 'rounded full', { props: { ui: { rounded: 'rounded-full' } } } ],
[ '<UButton icon="i-heroicons-pencil-square" size="sm" color="primary" square variant="solid" />' ]
// @ts-ignore
])('renders %s correctly', async (nameOrHtml: string, options: ButtonOptions) => {
if (options !== undefined) {
options.slots = options.slots || { default: () => 'label' }

View File

@@ -7,6 +7,7 @@ describe('Skeleton', () => {
it.each([
[ 'basic case', { } ],
[ '<USkeleton class="h-12 w-12" :ui="{ rounded: \'rounded-full\' }" />' ]
// @ts-ignore
])('renders %s correctly', async (nameOrHtml: string, options: TypeOf<typeof Skeleton.props>) => {
const html = await ComponentRender(nameOrHtml, options, Skeleton)
expect(html).toMatchSnapshot()

View File

@@ -1,7 +1,5 @@
import module from '../../src/module'
export default defineNuxtConfig({
modules: [
module
'../../src/module'
]
})

View File

@@ -1,3 +0,0 @@
{
// "extends": "./.nuxt/tsconfig.json"
}