test: tests for memoize
This commit is contained in:
@@ -18,6 +18,7 @@ export { createAsyncComponent } from './optional/asyncComponent'
|
||||
export { KeepAlive } from './optional/keepAlive'
|
||||
export { mixins } from './optional/mixins'
|
||||
export { EventEmitter } from './optional/eventEmitter'
|
||||
export { memoize } from './optional/memoize'
|
||||
export { withHooks, useState, useEffect } from './optional/hooks'
|
||||
|
||||
// flags & types
|
||||
|
||||
@@ -17,13 +17,13 @@ import { warn } from '../warning'
|
||||
|
||||
const memoizeMap = new WeakMap()
|
||||
|
||||
export function memoize(
|
||||
getter: () => any,
|
||||
export function memoize<T>(
|
||||
getter: () => T,
|
||||
instance: Component,
|
||||
id: number,
|
||||
keys?: any[]
|
||||
): any {
|
||||
if (__DEV__ && !Array.isArray(keys)) {
|
||||
): T {
|
||||
if (__DEV__ && arguments.length > 3 && !Array.isArray(keys)) {
|
||||
warn(
|
||||
`keys passed to v-memo or memoize must be an array. Got ${String(keys)}`
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user