File tree 1 file changed +5
-2
lines changed
packages/runtime-core/src
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { isFunction } from '@vue/shared'
2
2
import { currentInstance } from './component'
3
3
import { currentRenderingInstance } from './componentRenderContext'
4
- import { App , currentApp } from './apiCreateApp'
4
+ import { currentApp } from './apiCreateApp'
5
5
import { warn } from './warning'
6
+ import { ComponentPublicInstance } from './componentPublicInstance'
6
7
7
8
export interface InjectionKey < T > extends Symbol { }
8
9
@@ -64,7 +65,9 @@ export function inject(
64
65
return provides [ key as string ]
65
66
} else if ( arguments . length > 1 ) {
66
67
return treatDefaultAsFactory && isFunction ( defaultValue )
67
- ? defaultValue . call ( ( instance as App & { proxy : undefined } ) . proxy )
68
+ ? defaultValue . call (
69
+ ( instance as { proxy ?: ComponentPublicInstance | null } ) . proxy
70
+ )
68
71
: defaultValue
69
72
} else if ( __DEV__ ) {
70
73
warn ( `injection "${ String ( key ) } " not found.` )
You can’t perform that action at this time.
0 commit comments