File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 99 UnionToIntersection ,
1010 isFunction ,
1111} from './utils'
12- import Vue$1 from 'vue'
12+ import type Vue$1 from 'vue'
1313
1414let vueDependency : VueConstructor | undefined = undefined
1515
Original file line number Diff line number Diff line change 1- import Vue from 'vue '
1+ import { getRegisteredVueOrDefault } from '../runtimeContext '
22
33const toString = ( x : any ) => Object . prototype . toString . call ( x )
44
@@ -99,7 +99,9 @@ export function isUndef(v: any): boolean {
9999}
100100
101101export function warn ( msg : string , vm ?: Vue ) {
102- Vue . util . warn ( msg , vm )
102+ const Vue = getRegisteredVueOrDefault ( )
103+ if ( ! Vue || ! Vue . util ) console . warn ( `[vue-composition-api] ${ msg } ` )
104+ else Vue . util . warn ( msg , vm )
103105}
104106
105107export function logError ( err : Error , vm : Vue , info : string ) {
Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ import {
88 shallowReactive ,
99 nextTick ,
1010} from '../../../src'
11- import Vue from 'vue '
11+ import { getRegisteredVueOrDefault } from '../../../src/runtimeContext '
1212
1313// reference: https://vue-composition-api-rfc.netlify.com/api.html#watch
1414
1515describe ( 'api: watch' , ( ) => {
16+ const Vue = getRegisteredVueOrDefault ( )
1617 // const warnSpy = jest.spyOn(console, 'warn');
1718 const warnSpy = jest . spyOn ( ( Vue as any ) . util , 'warn' )
1819
You can’t perform that action at this time.
0 commit comments