chore: remove `@ts-ignore` and fix some issues (#20273)

This commit is contained in:
Daniel Roe 2023-04-14 13:53:21 +01:00 committed by GitHub
parent b602b66a8e
commit f366ab4eb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 116 additions and 117 deletions

View File

@ -73,6 +73,13 @@
"disallowTypeAnnotations": false
}
],
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-expect-error": "allow-with-description",
"ts-ignore": true
}
],
"@typescript-eslint/no-unused-vars": [
"error",
{

View File

@ -2,7 +2,7 @@ import { defineLazyEventHandler } from 'h3'
export default defineLazyEventHandler(async () => {
const { exports: { sum } } = await loadWasmInstance(
// @ts-ignore
// @ts-expect-error TODO: https://github.com/nuxt/nuxt/issues/14131
() => import('~/server/wasm/sum.wasm')
)

6
packages/kit/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
declare global {
var __NUXT_PREPATHS__: string[] | string | undefined
var __NUXT_PATHS__: string[] | string | undefined
}
export {}

View File

@ -85,14 +85,12 @@ export function getRequireCacheItem (id: string) {
/** @deprecated Do not use CJS utils */
export function resolveModule (id: string, opts: ResolveModuleOptions = {}) {
return normalize(_require.resolve(id, {
paths: ([] as string[]).concat(
// @ts-ignore
paths: ([] as Array<string | undefined>).concat(
global.__NUXT_PREPATHS__,
opts.paths || [],
process.cwd(),
// @ts-ignore
global.__NUXT_PATHS__
).filter(Boolean)
).filter(Boolean) as string[]
}))
}
@ -137,7 +135,7 @@ export function importModule (id: string, opts: RequireModuleOptions = {}) {
export function tryImportModule (id: string, opts: RequireModuleOptions = {}) {
try {
return importModule(id, opts).catch(() => undefined)
} catch { }
} catch {}
}
/** @deprecated Do not use CJS utils */

View File

@ -103,10 +103,8 @@ export function defineNuxtModule<OptionsT extends ModuleOptions> (definition: Mo
const NUXT2_SHIMS_KEY = '__nuxt2_shims_key__'
function nuxt2Shims (nuxt: Nuxt) {
// Avoid duplicate install and only apply to Nuxt2
// @ts-ignore
if (!isNuxt2(nuxt) || nuxt[NUXT2_SHIMS_KEY]) { return }
// @ts-ignore
nuxt[NUXT2_SHIMS_KEY] = true
if (!isNuxt2(nuxt) || nuxt[NUXT2_SHIMS_KEY as keyof Nuxt]) { return }
nuxt[NUXT2_SHIMS_KEY as keyof Nuxt] = true
// Allow using nuxt.hooks
// @ts-expect-error Nuxt 2 extends hookable
@ -120,14 +118,14 @@ function nuxt2Shims (nuxt: Nuxt) {
// Support virtual templates with getContents() by writing them to .nuxt directory
let virtualTemplates: ResolvedNuxtTemplate[]
// @ts-ignore Nuxt 2 hook
// @ts-expect-error Nuxt 2 hook
nuxt.hook('builder:prepared', (_builder, buildOptions) => {
virtualTemplates = buildOptions.templates.filter((t: any) => t.getContents)
for (const template of virtualTemplates) {
buildOptions.templates.splice(buildOptions.templates.indexOf(template), 1)
}
})
// @ts-ignore Nuxt 2 hook
// @ts-expect-error Nuxt 2 hook
nuxt.hook('build:templates', async (templates) => {
const context = {
nuxt,

View File

@ -7,7 +7,7 @@ import { isNuxt2 } from './compatibility'
export function extendPages (cb: NuxtHooks['pages:extend']) {
const nuxt = useNuxt()
if (isNuxt2(nuxt)) {
// @ts-expect-error
// @ts-expect-error TODO: Nuxt 2 hook
nuxt.hook('build:extendRoutes', cb)
} else {
nuxt.hook('pages:extend', cb)

View File

@ -1,5 +1,5 @@
// @ts-ignore
// @ts-expect-error internal property for tracking start time
process._startTime = Date.now()
// @ts-ignore
// @ts-expect-error `default` property is not declared
import('./cli').then(r => (r.default || r).main())

View File

@ -15,7 +15,6 @@ async function _main () {
'no-clear'
]
})
// @ts-ignore
const command = args._.shift() || 'usage'
showBanner(command === 'dev' && args.clear !== false && !args.help)
@ -30,7 +29,6 @@ async function _main () {
// Check Node.js version in background
setTimeout(() => { checkEngines().catch(() => {}) }, 1000)
// @ts-ignore default.default is hotfix for #621
const cmd = await commands[command as Command]() as NuxtCommand
if (args.h || args.help) {
showHelp(cmd.meta)

View File

@ -7,6 +7,7 @@ import destr from 'destr'
import { splitByCase } from 'scule'
import clipboardy from 'clipboardy'
import type { NuxtModule } from '@nuxt/schema'
import type { packageManagerLocks } from '../utils/packageManagers'
import { getPackageManager, getPackageManagerVersion } from '../utils/packageManagers'
import { findup } from '../utils/fs'
import { defineNuxtCommand } from './index'
@ -51,11 +52,10 @@ export default defineNuxtCommand({
? 'vite' /* nuxt-vite */
: 'webpack')
let packageManager = getPackageManager(rootDir)
let packageManager: keyof typeof packageManagerLocks | 'unknown' | null = getPackageManager(rootDir)
if (packageManager) {
packageManager += '@' + getPackageManagerVersion(packageManager)
} else {
// @ts-expect-error
packageManager = 'unknown'
}

View File

@ -4,11 +4,9 @@ import { dirname, normalize } from 'pathe'
export function getModulePaths (paths?: string | string[]): string[] {
return ([] as Array<string | undefined>)
.concat(
// @ts-expect-error global object
global.__NUXT_PREPATHS__,
paths,
process.cwd(),
// @ts-expect-error global object
global.__NUXT_PATHS__
)
.filter(Boolean) as string[]
@ -30,7 +28,7 @@ export function tryRequireModule (id: string, paths?: string | string[]) {
export function getNearestPackage (id: string, paths?: string | string[]) {
while (dirname(id) !== id) {
try { return requireModule(id + '/package.json', paths) } catch { }
try { return requireModule(id + '/package.json', paths) } catch {}
id = dirname(id)
}
return null

View File

@ -104,7 +104,7 @@ export const writeTypes = async (nuxt: Nuxt) => {
// This is needed for Nuxt 2 which clears the build directory again before building
// https://github.com/nuxt/nuxt/blob/2.x/packages/builder/src/builder.js#L144
// @ts-expect-error
// @ts-expect-error TODO: Nuxt 2 hook
nuxt.hook('builder:prepared', writeFile)
await writeFile()

View File

@ -1,5 +1,7 @@
declare global {
const __NUXT_VERSION__: string
var __NUXT_VERSION__: string
var __NUXT_PREPATHS__: string[] | string | undefined
var __NUXT_PATHS__: string[] | string | undefined
}
export {}

View File

@ -1,7 +1,7 @@
import type { defineAsyncComponent } from 'vue'
import { createVNode, defineComponent } from 'vue'
// @ts-ignore
// @ts-expect-error virtual file
import * as islandComponents from '#build/components.islands.mjs'
import { createError } from '#app/composables/error'

View File

@ -3,11 +3,11 @@ import { Transition, computed, defineComponent, h, inject, nextTick, onMounted,
import type { RouteLocationNormalizedLoaded } from 'vue-router'
import { _wrapIf } from './utils'
import { useRoute } from '#app/composables/router'
// @ts-ignore
// @ts-expect-error virtual file
import { useRoute as useVueRouterRoute } from '#build/pages'
// @ts-ignore
// @ts-expect-error virtual file
import layouts from '#build/layouts'
// @ts-ignore
// @ts-expect-error virtual file
import { appLayoutTransition as defaultLayoutTransition } from '#build/nuxt.config.mjs'
// TODO: revert back to defineAsyncComponent when https://github.com/vuejs/core/issues/6638 is resolved

View File

@ -29,7 +29,7 @@ export type MultiWatchSources = (WatchSource<unknown> | object)[]
export interface AsyncDataOptions<
ResT,
DataT = ResT,
PickKeys extends KeysOf<DataT> =KeysOf<DataT>,
PickKeys extends KeysOf<DataT> = KeysOf<DataT>,
> {
server?: boolean
lazy?: boolean
@ -270,7 +270,7 @@ export function useLazyAsyncData<
const autoKey = typeof args[args.length - 1] === 'string' ? args.pop() : undefined
if (typeof args[0] !== 'string') { args.unshift(autoKey) }
const [key, handler, options] = args as [string, (ctx?: NuxtApp) => Promise<ResT>, AsyncDataOptions<ResT, DataT, PickKeys>]
// @ts-ignore
// @ts-expect-error we pass an extra argument to prevent a key being injected
return useAsyncData(key, handler, { ...options, lazy: true }, null)
}

View File

@ -151,6 +151,6 @@ export function useLazyFetch<
...opts,
lazy: true
},
// @ts-ignore
// @ts-expect-error we pass an extra argument with the resolved auto-key to prevent another from being injected
autoKey)
}

View File

@ -1,7 +1,7 @@
import { reactive } from 'vue'
import type { AppConfig } from 'nuxt/schema'
import { useNuxtApp } from './nuxt'
// @ts-ignore
// @ts-expect-error virtual file
import __appConfig from '#build/app.config.mjs'
type DeepPartial<T> = T extends Function ? T : T extends Record<string, any> ? { [P in keyof T]?: DeepPartial<T[P]> } : T

View File

@ -1,23 +1,27 @@
// We set __webpack_public_path via this import with webpack builder
import { createApp, createSSRApp, nextTick } from 'vue'
import { $fetch } from 'ofetch'
// @ts-ignore
import type { $Fetch, NitroFetchRequest } from 'nitropack'
// This file must be imported first for webpack as we set __webpack_public_path__ there
// @ts-expect-error virtual file
import { baseURL } from '#build/paths.mjs'
import type { CreateOptions } from '#app'
import { applyPlugins, createNuxtApp, normalizePlugins } from '#app/nuxt'
import '#build/css'
// @ts-ignore
// @ts-expect-error virtual file
import _plugins from '#build/plugins'
// @ts-ignore
// @ts-expect-error virtual file
import RootComponent from '#build/root-component.mjs'
// @ts-ignore
// @ts-expect-error virtual file
import { appRootId } from '#build/nuxt.config.mjs'
if (!globalThis.$fetch) {
// @ts-ignore
globalThis.$fetch = $fetch.create({
baseURL: baseURL()
})
}) as $Fetch<unknown, NitroFetchRequest>
}
let entry: Function
@ -45,9 +49,7 @@ if (process.server) {
if (process.client) {
// TODO: temporary webpack 5 HMR fix
// https://github.com/webpack-contrib/webpack-hot-middleware/issues/390
// @ts-ignore
if (process.dev && import.meta.webpackHot) {
// @ts-ignore
import.meta.webpackHot.accept()
}

View File

@ -239,7 +239,6 @@ export function createNuxtApp (options: CreateOptions) {
// Inject $nuxt
defineGetter(nuxtApp.vueApp, '$nuxt', nuxtApp)
// @ts-expect-error
defineGetter(nuxtApp.vueApp.config.globalProperties, '$nuxt', nuxtApp)
if (process.server) {

View File

@ -7,7 +7,7 @@ import { navigateTo } from '../composables/router'
import { useState } from '../composables/state'
import { useRequestEvent } from '../composables/ssr'
// @ts-ignore
// @ts-expect-error virtual file
import { globalMiddleware } from '#build/middleware'
interface Route {

View File

@ -22,6 +22,9 @@ declare module 'vue' {
interface App<HostElement> {
$nuxt: NuxtApp
}
interface ComponentCustomProperties {
$nuxt: NuxtApp
}
interface ComponentInternalInstance {
_nuxtOnBeforeMountCbs: Function[]
}

View File

@ -55,9 +55,9 @@ export default <NitroErrorHandler> async function errorhandler (error: H3Error,
// Fallback to static rendered error page
if (!res) {
const { template } = process.dev
// @ts-ignore
// @ts-expect-error TODO: add legacy type support for subpath imports
? await import('@nuxt/ui-templates/templates/error-dev.mjs')
// @ts-ignore
// @ts-expect-error TODO: add legacy type support for subpath imports
: await import('@nuxt/ui-templates/templates/error-500.mjs')
if (process.dev) {
// TODO: Support `message` in template

View File

@ -1,5 +1,4 @@
import { joinURL } from 'ufo'
// @ts-ignore
import { useRuntimeConfig } from '#internal/nitro'
export function baseURL (): string {

View File

@ -15,14 +15,14 @@ import { useNitroApp } from '#internal/nitro/app'
// eslint-disable-next-line import/no-restricted-paths
import type { NuxtApp, NuxtSSRContext } from '#app/nuxt'
// @ts-ignore
// @ts-expect-error virtual file
import { appRootId, appRootTag } from '#internal/nuxt.config.mjs'
// @ts-ignore
// @ts-expect-error virtual file
import { buildAssetsURL, publicAssetsURL } from '#paths'
// @ts-ignore
// @ts-expect-error private property consumed by vite-generated url helpers
globalThis.__buildAssetsURL = buildAssetsURL
// @ts-ignore
// @ts-expect-error private property consumed by vite-generated url helpers
globalThis.__publicAssetsURL = publicAssetsURL
export interface NuxtRenderHTMLContext {
@ -61,18 +61,18 @@ export interface NuxtRenderResponse {
interface ClientManifest {}
// @ts-ignore
// @ts-expect-error file will be produced after app build
const getClientManifest: () => Promise<Manifest> = () => import('#build/dist/server/client.manifest.mjs')
.then(r => r.default || r)
.then(r => typeof r === 'function' ? r() : r) as Promise<ClientManifest>
// @ts-ignore
// @ts-expect-error virtual file
const getStaticRenderedHead = (): Promise<NuxtMeta> => import('#head-static').then(r => r.default || r)
// @ts-ignore
// @ts-expect-error file will be produced after app build
const getServerEntry = () => import('#build/dist/server/server.mjs').then(r => r.default || r)
// @ts-ignore
// @ts-expect-error file will be produced after app build
const getSSRStyles = lazyCachedFunction((): Promise<Record<string, () => Promise<string[]>>> => import('#build/dist/server/styles.mjs').then(r => r.default || r))
// -- SSR Renderer --

View File

@ -10,7 +10,7 @@ import {
resolveSchema as resolveUntypedSchema
} from 'untyped'
import type { Schema, SchemaDefinition } from 'untyped'
// @ts-ignore
// @ts-expect-error TODO: add upstream type
import untypedPlugin from 'untyped/babel-plugin'
import jiti from 'jiti'
@ -76,7 +76,7 @@ export default defineNuxtModule({
async function resolveSchema () {
// Global import
// @ts-ignore
// @ts-expect-error adding to globalThis for 'auto-import' support within nuxt.config file
globalThis.defineNuxtSchema = (val: any) => val
// Load schema from layers
@ -107,9 +107,8 @@ export default defineNuxtModule({
schemaDefs.map(schemaDef => resolveUntypedSchema(schemaDef))
)
// @ts-expect-error
// Merge after normalization
const schema = defu(...schemas)
const schema = defu(...schemas as [Schema, Schema])
// Allow hooking to extend resolved schema
await nuxt.hooks.callHook('schema:resolved', schema)

View File

@ -306,12 +306,10 @@ export const nuxtConfigTemplate = {
function _resolveId (id: string) {
return resolvePath(id, {
url: [
// @ts-ignore
global.__NUXT_PREPATHS__,
...(typeof global.__NUXT_PREPATHS__ === 'string' ? [global.__NUXT_PREPATHS__] : global.__NUXT_PREPATHS__ || []),
import.meta.url,
process.cwd(),
// @ts-ignore
global.__NUXT_PATHS__
...(typeof global.__NUXT_PATHS__ === 'string' ? [global.__NUXT_PATHS__] : global.__NUXT_PATHS__ || [])
]
})
}

View File

@ -8,7 +8,7 @@ import type { RouterViewSlotProps } from './utils'
import { generateRouteKey, wrapInKeepAlive } from './utils'
import { useNuxtApp } from '#app/nuxt'
import { _wrapIf } from '#app/components/utils'
// @ts-ignore
// @ts-expect-error virtual file
import { appKeepalive as defaultKeepaliveConfig, appPageTransition as defaultPageTransition } from '#build/nuxt.config.mjs'
export default defineComponent({
@ -73,8 +73,7 @@ function _mergeTransitionProps (routeProps: TransitionProps[]): TransitionProps
...prop,
onAfterLeave: _toArray(prop.onAfterLeave)
}))
// @ts-ignore
return defu(..._props)
return defu(..._props as [TransitionProps, TransitionProps])
}
const RouteProvider = defineComponent({

View File

@ -1,9 +1,9 @@
import { hasProtocol } from 'ufo'
import { defineNuxtPlugin } from '#app/nuxt'
import { useRouter } from '#app/composables/router'
// @ts-ignore
// @ts-expect-error virtual file
import layouts from '#build/layouts'
// @ts-ignore
// @ts-expect-error virtual file
import { namedMiddleware } from '#build/middleware'
export default defineNuxtPlugin({

View File

@ -16,11 +16,11 @@ import { clearError, showError, useError } from '#app/composables/error'
import { useState } from '#app/composables/state'
import { navigateTo } from '#app/composables/router'
// @ts-ignore
// @ts-expect-error virtual file
import _routes from '#build/routes'
// @ts-ignore
// @ts-expect-error virtual file
import routerOptions from '#build/router.options'
// @ts-ignore
// @ts-expect-error virtual file
import { globalMiddleware, namedMiddleware } from '#build/middleware'
// https://github.com/vuejs/router/blob/4a0cc8b9c1e642cdf47cc007fa5bbebde70afc66/packages/router/src/history/html5.ts#L37

View File

@ -2,7 +2,7 @@ import type { RouteLocationNormalized, RouterScrollBehavior } from 'vue-router'
import { nextTick } from 'vue'
import type { RouterConfig } from 'nuxt/schema'
import { useNuxtApp } from '#app/nuxt'
// @ts-ignore
// @ts-expect-error virtual file
import { appPageTransition as defaultPageTransition } from '#build/nuxt.config.mjs'
type ScrollPosition = Awaited<ReturnType<RouterScrollBehavior>>

View File

@ -225,7 +225,7 @@ const srcDir = rFixture('.')
it('components:scanComponents', async () => {
const scannedComponents = await scanComponents(dirs, srcDir)
for (const c of scannedComponents) {
// @ts-ignore
// @ts-expect-error filePath is not optional but we don't want it to be in the snapshot
delete c.filePath
}
expect(scannedComponents).deep.eq(expectedComponents)

View File

@ -258,9 +258,10 @@ export default defineUntypedSchema({
/**
* Customize PostCSS Loader.
* Same options as https://github.com/webpack-contrib/postcss-loader#options
*
* @type {{ execute?: boolean, postcssOptions: typeof import('postcss').ProcessOptions, sourceMap?: boolean, implementation?: any }}
*/
postcss: {
execute: undefined,
postcssOptions: {
config: {
$resolve: async (val, get) => val ?? (await get('postcss.config'))
@ -269,9 +270,6 @@ export default defineUntypedSchema({
$resolve: async (val, get) => val ?? (await get('postcss.plugins'))
}
},
sourceMap: undefined,
implementation: undefined,
order: ''
},
/**

View File

@ -4,7 +4,7 @@ import { defu } from 'defu'
import * as _kit from '@nuxt/kit'
import { useTestContext } from './context'
// @ts-ignore type cast
// @ts-expect-error type cast
// eslint-disable-next-line
const kit: typeof _kit = _kit.default || _kit

View File

@ -1,7 +1,7 @@
import * as _kit from '@nuxt/kit'
import { createTest, exposeContextToEnv } from '@nuxt/test-utils'
// @ts-ignore type cast
// @ts-expect-error type cast
// eslint-disable-next-line
const kit: typeof _kit = _kit.default || _kit

View File

@ -6,7 +6,7 @@ import * as _kit from '@nuxt/kit'
import { resolve } from 'pathe'
import { useTestContext } from './context'
// @ts-ignore type cast
// @ts-expect-error type cast
// eslint-disable-next-line
const kit: typeof _kit = _kit.default || _kit

View File

@ -1,7 +1,7 @@
import type { TestHooks } from '../types'
export default async function setupJest (hooks: TestHooks) {
// @ts-ignore
// @ts-expect-error jest is not a dependency
const jest = await import('jest')
hooks.ctx.mockFn = jest.fn

View File

@ -4,6 +4,8 @@ import { visualizer } from 'rollup-plugin-visualizer'
import type { ViteBuildContext } from '../vite'
export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
if (typeof ctx.nuxt.options.build.analyze === 'boolean') { return [] }
return [
{
name: 'nuxt:analyze-minify',
@ -19,11 +21,9 @@ export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
}
}
},
// @ts-ignore
visualizer({
...ctx.nuxt.options.build.analyze as any,
// @ts-ignore
filename: ctx.nuxt.options.build.analyze.filename.replace('{name}', 'client'),
...ctx.nuxt.options.build.analyze,
filename: 'filename' in ctx.nuxt.options.build.analyze ? ctx.nuxt.options.build.analyze.filename!.replace('{name}', 'client') : undefined,
title: 'Client bundle stats',
gzipSize: true
})

View File

@ -88,28 +88,28 @@ function basePlugins (ctx: WebpackConfigContext) {
name: ctx.name,
color: colors[ctx.name as keyof typeof colors],
reporters: ['stats'],
// @ts-expect-error TODO: this is a valid option for Webpack.ProgressPlugin and needs to be declared for WebpackBar
stats: !ctx.isDev,
reporter: {
// @ts-ignore
change: (_, { shortPath }) => {
if (!ctx.isServer) {
nuxt.callHook('webpack:change', shortPath)
reporter: {
change: (_, { shortPath }) => {
if (!ctx.isServer) {
nuxt.callHook('webpack:change', shortPath)
}
},
done: ({ state }) => {
if (state.hasErrors) {
nuxt.callHook('webpack:error')
} else {
logger.success(`${state.name} ${state.message}`)
}
},
allDone: () => {
nuxt.callHook('webpack:done')
},
progress ({ statesArray }) {
nuxt.callHook('webpack:progress', statesArray)
}
},
// @ts-ignore
done: ({ state }) => {
if (state.hasErrors) {
nuxt.callHook('webpack:error')
} else {
logger.success(`${state.name} ${state.message}`)
}
},
allDone: () => {
nuxt.callHook('webpack:done')
},
// @ts-ignore
progress ({ statesArray }) {
nuxt.callHook('webpack:progress', statesArray)
}
}
}))

View File

@ -8,8 +8,8 @@ import type { WebpackConfigContext } from '../utils/config'
export function vue (ctx: WebpackConfigContext) {
const { options, config } = ctx
// @ts-ignore
config.plugins.push(new (VueLoaderPlugin.default || VueLoaderPlugin)())
// @ts-expect-error de-default vue-loader
config.plugins!.push(new (VueLoaderPlugin.default || VueLoaderPlugin)())
config.module!.rules!.push({
test: /\.vue$/i,

View File

@ -3,7 +3,7 @@ import type { Configuration } from 'webpack'
import type { Nuxt } from '@nuxt/schema'
import { logger } from '@nuxt/kit'
export interface WebpackConfigContext extends ReturnType<typeof createWebpackConfigContext>{ }
export interface WebpackConfigContext extends ReturnType<typeof createWebpackConfigContext> {}
type WebpackConfigPreset = (ctx: WebpackConfigContext, options?: object) => void
type WebpackConfigPresetItem = WebpackConfigPreset | [WebpackConfigPreset, any]
@ -63,7 +63,7 @@ export function getWebpackConfig (ctx: WebpackConfigContext): Configuration {
const builder = {}
const loaders: any[] = []
// @ts-ignore
// @ts-expect-error TODO: remove support for `build.extend` in v3.5
const { extend } = options.build
if (typeof extend === 'function') {
const extendedConfig = extend.call(

View File

@ -17,7 +17,7 @@ export function createMFS () {
// Used by vue-renderer
_fs.exists = p => Promise.resolve(_fs.existsSync(p))
// @ts-ignore
// @ts-expect-error need better types for `pify`
_fs.readFile = pify(_fs.readFile)
return _fs as IFs & { join?(...paths: string[]): string }

View File

@ -71,11 +71,7 @@ export const getPostcssConfig = (nuxt: Nuxt) => {
loadPlugins(postcssOptions)
}
// @ts-expect-error
delete nuxt.options.webpack.postcss.order
return {
// @ts-expect-error
sourceMap: nuxt.options.webpack.cssSourceMap,
...nuxt.options.webpack.postcss,
postcssOptions

View File

@ -90,7 +90,7 @@ async function createDevMiddleware (compiler: Compiler) {
...nuxt.options.webpack.devMiddleware
})
// @ts-ignore
// @ts-expect-error need better types for `pify`
nuxt.hook('close', () => pify(devMiddleware.close.bind(devMiddleware))())
const { client: _client, ...hotMiddlewareOptions } = nuxt.options.webpack.hotMiddleware || {}

View File

@ -67,7 +67,6 @@ const crawler = new Crawler({
callback (error, res, done) {
const { $ } = res
const { uri } = res.options
// @ts-ignore
const { statusCode } = res.request.response
if (error || ![200, 301, 302].includes(statusCode) || !$) {

View File

@ -1,4 +1,4 @@
// @ts-ignore
// @ts-expect-error assigning property to window object to break SSR
window.test = true
export default defineComponent({

View File

@ -120,9 +120,9 @@ describe('layouts', () => {
describe('modules', () => {
it('augments schema automatically', () => {
defineNuxtConfig({ sampleModule: { enabled: false } })
// @ts-expect-error
// @ts-expect-error we want to ensure we throw type error on invalid option
defineNuxtConfig({ sampleModule: { other: false } })
// @ts-expect-error
// @ts-expect-error we want to ensure we throw type error on invalid key
defineNuxtConfig({ undeclaredKey: { other: false } })
})
})
@ -158,7 +158,7 @@ describe('runtimeConfig', () => {
const val = defineNuxtConfig({
runtimeConfig: {
public: {
// @ts-expect-error
// @ts-expect-error this should be a number
testConfig: 'test',
ids: [1, 2]
}