Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/apis/createElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export const createElement = function createElement(...args: any) {
}

return instance.$createElement.apply(instance, args)
} as any as CreateElement
} as CreateElement
2 changes: 1 addition & 1 deletion src/apis/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function injectHookOption(
hook: string,
val: Function
) {
const options = vm.$options as any
const options = vm.$options as Record<string, unknown>
const mergeFn = Vue.config.optionMergeStrategies[hook]
options[hook] = mergeFn(options[hook], wrapHookCall(vm, val))
}
Expand Down
2 changes: 1 addition & 1 deletion src/apis/nextTick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export const nextTick: NextTick = function nextTick(
...args: Parameters<NextTick>
) {
return getVueConstructor()?.nextTick.apply(this, args)
} as any
}
4 changes: 2 additions & 2 deletions src/apis/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ function createWatcher(
fn(...args)
},
flushMode as 'pre' | 'post'
)) as any as T
)) as unknown as T
}

// effect watch
Expand Down Expand Up @@ -471,7 +471,7 @@ function traverse(value: unknown, seen: Set<unknown> = new Set()) {
})
} else if (isPlainObject(value)) {
for (const key in value) {
traverse((value as any)[key], seen)
traverse(value[key], seen)
}
}
return value
Expand Down
8 changes: 4 additions & 4 deletions src/reactivity/reactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,20 @@ export function createObserver() {
}

export function shallowReactive<T extends object = any>(obj: T): T
export function shallowReactive(obj: any): any {
export function shallowReactive(obj: any) {
if (!isObject(obj)) {
if (__DEV__) {
warn('"shallowReactive()" must be called on an object.')
}
return obj as any
return obj
}

if (
!(isPlainObject(obj) || isArray(obj)) ||
isRaw(obj) ||
!Object.isExtensible(obj)
) {
return obj as any
return obj
}

const observed = observe(isArray(obj) ? [] : {})
Expand Down Expand Up @@ -233,7 +233,7 @@ export function reactive<T extends object>(obj: T): UnwrapRef<T> {
if (__DEV__) {
warn('"reactive()" must be called on an object.')
}
return obj as any
return obj
}

if (
Expand Down
2 changes: 1 addition & 1 deletion src/reactivity/ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function toRefs<T extends object>(obj: T): ToRefs<T> {
if (__DEV__ && !isReactive(obj)) {
warn(`toRefs() expects a reactive object but received a plain one.`)
}
if (!isPlainObject(obj)) return obj as any
if (!isPlainObject(obj)) return obj

const ret: any = {}
for (const key in obj) {
Expand Down
6 changes: 3 additions & 3 deletions src/runtimeContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function toVue3ComponentInstance(
return instanceMapCache.get(vue2Instance)!
}

const instance: ComponentInternalInstance = ({
const instance: ComponentInternalInstance = {
proxy: vue2Instance,
update: vue2Instance.$forceUpdate,
uid: vue2Instance._uid,
Expand All @@ -177,8 +177,8 @@ function toVue3ComponentInstance(
emit: vue2Instance.$emit.bind(vue2Instance),

parent: null,
root: null as any,
} as unknown) as ComponentInternalInstance
root: null!, // to be immediately set
} as unknown as ComponentInternalInstance

// map vm.$props =
const instanceProps = [
Expand Down