types: massive refactor
This commit is contained in:
@@ -2,8 +2,12 @@ import { VNodeChild } from '../vnode'
|
||||
import { isArray, isString, isObject } from '@vue/shared'
|
||||
|
||||
export function renderList(
|
||||
source: any,
|
||||
renderItem: (value: any, key: string | number, index?: number) => VNodeChild
|
||||
source: unknown,
|
||||
renderItem: (
|
||||
value: unknown,
|
||||
key: string | number,
|
||||
index?: number
|
||||
) => VNodeChild
|
||||
): VNodeChild[] {
|
||||
let ret: VNodeChild[]
|
||||
if (isArray(source) || isString(source)) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Data } from '../component'
|
||||
import { Slot } from '../componentSlots'
|
||||
import {
|
||||
VNodeChildren,
|
||||
@@ -11,7 +12,7 @@ import { PatchFlags } from '@vue/shared'
|
||||
export function renderSlot(
|
||||
slots: Record<string, Slot>,
|
||||
name: string,
|
||||
props: any = {},
|
||||
props: Data = {},
|
||||
// this is not a user-facing function, so the fallback is always generated by
|
||||
// the compiler and guaranteed to be an array
|
||||
fallback?: VNodeChildren
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { isArray, isPlainObject, objectToString } from '@vue/shared'
|
||||
|
||||
// for converting {{ interpolation }} values to displayed strings.
|
||||
export function toString(val: any): string {
|
||||
export function toString(val: unknown): string {
|
||||
return val == null
|
||||
? ''
|
||||
: isArray(val) || (isPlainObject(val) && val.toString === objectToString)
|
||||
? JSON.stringify(val, null, 2)
|
||||
: String(val)
|
||||
? JSON.stringify(val, null, 2)
|
||||
: String(val)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user