Skip to content

Commit 590ae7e

Browse files
pikaxliximomo
authored andcommitted
refactor: remove as any
1 parent 9d8855a commit 590ae7e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/reactivity/set.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function set<T>(target: any, key: any, val: T): T {
4141
target[key] = val;
4242
return val;
4343
}
44-
const ob = (target as any).__ob__;
44+
const ob = target.__ob__;
4545
if (target._isVue || (ob && ob.vmCount)) {
4646
process.env.NODE_ENV !== 'production' &&
4747
warn(

src/setup.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,18 @@ export function mixin(Vue: VueConstructor) {
142142
if (!binding) return;
143143

144144
if (isFunction(binding)) {
145+
// keep typescript happy with the binding type.
146+
const bindingFunc = binding;
145147
// keep currentInstance accessible for createElement
146-
vm.$options.render = () =>
147-
activateCurrentInstance(vm, vm_ => (binding as any)(vm_.$props, ctx));
148+
vm.$options.render = () => activateCurrentInstance(vm, vm_ => bindingFunc(vm_.$props, ctx));
148149
return;
149150
}
150151

151152
if (isPlainObject(binding)) {
153+
const bindingObj = binding;
152154
vmStateManager.set(vm, 'rawBindings', binding);
153155
Object.keys(binding).forEach(name => {
154-
let bindingValue = (binding as any)[name];
156+
let bindingValue = bindingObj[name];
155157
// only make primitive value reactive
156158
if (!isRef(bindingValue)) {
157159
if (isReactive(bindingValue)) {

0 commit comments

Comments
 (0)