}
}
-function propertyToRef(source: object, key: string, defaultValue?: unknown) {
- const val = (source as any)[key]
+function propertyToRef(
+ source: Record<string, any>,
+ key: string,
+ defaultValue?: unknown
+) {
+ const val = source[key]
return isRef(val)
? val
- : (new ObjectRefImpl(
- source as Record<string, any>,
- key,
- defaultValue
- ) as any)
+ : (new ObjectRefImpl(source, key, defaultValue) as any)
}
// corner case when use narrows type
if (loaded.value && resolvedComp) {
return createInnerComp(resolvedComp, instance)
} else if (error.value && errorComponent) {
- return createVNode(errorComponent as ConcreteComponent, {
+ return createVNode(errorComponent, {
error: error.value
})
} else if (loadingComponent && !delayed.value) {
- return createVNode(loadingComponent as ConcreteComponent)
+ return createVNode(loadingComponent)
}
}
}
import { computed as _computed } from '@vue/reactivity'
import { isInSSRComponentSetup } from './component'
-export const computed = ((getterOrOptions: any, debugOptions?: any) => {
+export const computed: typeof _computed = (
+ getterOrOptions: any,
+ debugOptions?: any
+) => {
// @ts-ignore
return _computed(getterOrOptions, debugOptions, isInSSRComponentSetup)
-}) as typeof _computed
+}
` you need to unmount the previous app by calling \`app.unmount()\` first.`
)
}
- const vnode = createVNode(
- rootComponent as ConcreteComponent,
- rootProps
- )
+ const vnode = createVNode(rootComponent, rootProps)
// store app context on the root VNode.
// this will be set on the root instance on initial mount.
vnode.appContext = context
import { checkCompatEnabled, isCompatEnabled } from './compat/compatConfig'
import { ObjectWatchOptionItem } from './componentOptions'
import { useSSRContext } from '@vue/runtime-core'
-import { SSRContext } from '@vue/server-renderer'
export type WatchEffect = (onCleanup: OnCleanup) => void
])
}
if (flush === 'sync') {
- const ctx = useSSRContext() as SSRContext
+ const ctx = useSSRContext()!
ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = [])
} else {
return NOOP
deep ||
forceTrigger ||
(isMultiSource
- ? (newValue as any[]).some((v, i) =>
- hasChanged(v, (oldValue as any[])[i])
- )
+ ? (newValue as any[]).some((v, i) => hasChanged(v, oldValue[i]))
: hasChanged(newValue, oldValue)) ||
(__COMPAT__ &&
isArray(newValue) &&
})
} else if (isPlainObject(value)) {
for (const key in value) {
- traverse((value as any)[key], seen)
+ traverse(value[key], seen)
}
}
return value
M extends MethodOptions = MethodOptions
> =
| ComponentOptions<Props, RawBindings, D, C, M>
- | FunctionalComponent<Props, any, any>
+ | FunctionalComponent<Props, any>
/**
* A type used in public APIs where a component type is expected.
const onceHandler = props[handlerName + `Once`]
if (onceHandler) {
if (!instance.emitted) {
- instance.emitted = {} as Record<any, boolean>
+ instance.emitted = {}
} else if (instance.emitted[handlerName]) {
return
}
if (isArray(hook)) {
hook.forEach(_hook => register(_hook.bind(publicThis)))
} else if (hook) {
- register((hook as Function).bind(publicThis))
+ register(hook.bind(publicThis))
}
}
injectOptions = normalizeInject(injectOptions)!
}
for (const key in injectOptions) {
- const opt = (injectOptions as ObjectInjectOptions)[key]
+ const opt = injectOptions[key]
let injected: unknown
if (isObject(opt)) {
if ('default' in opt) {
}[T extends ComponentOptionsMixin ? 'Mixin' : never]
export type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true
- ? OptionTypesType<{}, {}, {}, {}, {}>
+ ? OptionTypesType
: UnionToIntersection<ExtractMixin<T>>
export type UnwrapMixinsType<
extend(oldComp, newComp)
for (const key in oldComp) {
if (key !== '__file' && !(key in newComp)) {
- delete (oldComp as any)[key]
+ delete oldComp[key]
}
}
}