Skip to content

Commit 02945b9

Browse files
committed
chore: add extra types for empty array definitions
1 parent 7dfc856 commit 02945b9

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

packages/nuxt/src/app/components/nuxt-island.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Component, PropType } from 'vue'
1+
import type { Component, PropType, VNode } from 'vue'
22
import { Fragment, Teleport, computed, createStaticVNode, createVNode, defineComponent, getCurrentInstance, h, nextTick, onMounted, ref, toRaw, watch, withMemo } from 'vue'
33
import { debounce } from 'perfect-debounce'
44
import { hash } from 'ohash'
@@ -29,7 +29,7 @@ const getId = import.meta.client ? () => (id++).toString() : randomUUID
2929
const components = import.meta.client ? new Map<string, Component>() : undefined
3030

3131
async function loadComponents (source = appBaseURL, paths: NuxtIslandResponse['components']) {
32-
const promises = []
32+
const promises: Array<Promise<void>> = []
3333

3434
for (const component in paths) {
3535
if (!(components!.has(component))) {
@@ -259,7 +259,7 @@ export default defineComponent({
259259

260260
// should away be triggered ONE tick after re-rendering the static node
261261
withMemo([teleportKey.value], () => {
262-
const teleports = []
262+
const teleports: Array<VNode> = []
263263
// this is used to force trigger Teleport when vue makes the diff between old and new node
264264
const isKeyOdd = teleportKey.value === 0 || !!(teleportKey.value && !(teleportKey.value % 2))
265265

packages/nuxt/src/app/components/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function vforToArray (source: any): any[] {
8686
if (import.meta.dev && !Number.isInteger(source)) {
8787
console.warn(`The v-for range expect an integer value but got ${source}.`)
8888
}
89-
const array = []
89+
const array: number[] = []
9090
for (let i = 0; i < source; i++) {
9191
array[i] = i
9292
}

packages/nuxt/src/core/nuxt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ const RESTART_RE = /^(?:app|error|app\.config)\.(?:js|ts|mjs|jsx|tsx|vue)$/i
698698
function deduplicateArray<T = unknown> (maybeArray: T): T {
699699
if (!Array.isArray(maybeArray)) { return maybeArray }
700700

701-
const fresh = []
701+
const fresh: any[] = []
702702
const hashes = new Set<string>()
703703
for (const item of maybeArray) {
704704
const _hash = hash(item)

packages/nuxt/src/core/runtime/nitro/renderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
400400
// 2. Styles
401401
head.push({ style: inlinedStyles })
402402
if (!isRenderingIsland || import.meta.dev) {
403-
const link = []
403+
const link: Link[] = []
404404
for (const style in styles) {
405405
const resource = styles[style]
406406
// Do not add links to resources that are inlined (vite v5+)

packages/nuxt/src/pages/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export async function getRouteMeta (contents: string, absolutePath: string): Pro
232232
}
233233

234234
if (property.value.type === 'ArrayExpression') {
235-
const values = []
235+
const values: string[] = []
236236
for (const element of property.value.elements) {
237237
if (!element) {
238238
continue

0 commit comments

Comments
 (0)