Skip to content

Commit

Permalink
fix: esm compactiblity, close #847
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Nov 5, 2021
1 parent bfc251a commit 251e663
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/shared/set/index.ts
@@ -1,4 +1,4 @@
import { isVue2, Ref } from 'vue-demi'
import { isVue2, Ref, set as _set } from 'vue-demi'

export function set<T>(ref: Ref<T>, value: T): void
export function set<O extends object, K extends keyof O>(target: O, key: K, value: O[K]): void
Expand All @@ -13,9 +13,8 @@ export function set(...args: any[]) {
}
if (args.length === 3) {
if (isVue2) {
// use @vue/composition-api's set API
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('vue-demi').set(...args)
// @ts-expect-error
_set(...args)
}
else {
const [target, key, value] = args
Expand Down

0 comments on commit 251e663

Please sign in to comment.