mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
chore: add extra types for empty array definitions
This commit is contained in:
parent
7dfc85623b
commit
02945b9fa6
@ -1,4 +1,4 @@
|
||||
import type { Component, PropType } from 'vue'
|
||||
import type { Component, PropType, VNode } from 'vue'
|
||||
import { Fragment, Teleport, computed, createStaticVNode, createVNode, defineComponent, getCurrentInstance, h, nextTick, onMounted, ref, toRaw, watch, withMemo } from 'vue'
|
||||
import { debounce } from 'perfect-debounce'
|
||||
import { hash } from 'ohash'
|
||||
@ -29,7 +29,7 @@ const getId = import.meta.client ? () => (id++).toString() : randomUUID
|
||||
const components = import.meta.client ? new Map<string, Component>() : undefined
|
||||
|
||||
async function loadComponents (source = appBaseURL, paths: NuxtIslandResponse['components']) {
|
||||
const promises = []
|
||||
const promises: Array<Promise<void>> = []
|
||||
|
||||
for (const component in paths) {
|
||||
if (!(components!.has(component))) {
|
||||
@ -259,7 +259,7 @@ export default defineComponent({
|
||||
|
||||
// should away be triggered ONE tick after re-rendering the static node
|
||||
withMemo([teleportKey.value], () => {
|
||||
const teleports = []
|
||||
const teleports: Array<VNode> = []
|
||||
// this is used to force trigger Teleport when vue makes the diff between old and new node
|
||||
const isKeyOdd = teleportKey.value === 0 || !!(teleportKey.value && !(teleportKey.value % 2))
|
||||
|
||||
|
@ -86,7 +86,7 @@ export function vforToArray (source: any): any[] {
|
||||
if (import.meta.dev && !Number.isInteger(source)) {
|
||||
console.warn(`The v-for range expect an integer value but got ${source}.`)
|
||||
}
|
||||
const array = []
|
||||
const array: number[] = []
|
||||
for (let i = 0; i < source; i++) {
|
||||
array[i] = i
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ const RESTART_RE = /^(?:app|error|app\.config)\.(?:js|ts|mjs|jsx|tsx|vue)$/i
|
||||
function deduplicateArray<T = unknown> (maybeArray: T): T {
|
||||
if (!Array.isArray(maybeArray)) { return maybeArray }
|
||||
|
||||
const fresh = []
|
||||
const fresh: any[] = []
|
||||
const hashes = new Set<string>()
|
||||
for (const item of maybeArray) {
|
||||
const _hash = hash(item)
|
||||
|
@ -400,7 +400,7 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
|
||||
// 2. Styles
|
||||
head.push({ style: inlinedStyles })
|
||||
if (!isRenderingIsland || import.meta.dev) {
|
||||
const link = []
|
||||
const link: Link[] = []
|
||||
for (const style in styles) {
|
||||
const resource = styles[style]
|
||||
// Do not add links to resources that are inlined (vite v5+)
|
||||
|
@ -232,7 +232,7 @@ export async function getRouteMeta (contents: string, absolutePath: string): Pro
|
||||
}
|
||||
|
||||
if (property.value.type === 'ArrayExpression') {
|
||||
const values = []
|
||||
const values: string[] = []
|
||||
for (const element of property.value.elements) {
|
||||
if (!element) {
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user