refactor: types refactor

This commit is contained in:
Evan You
2018-10-08 18:09:13 -04:00
parent ba918b5afe
commit d22b71b27e
11 changed files with 74 additions and 64 deletions

View File

@@ -7,7 +7,7 @@ describe('2.x compat build', async () => {
const root = document.createElement('div')
document.body.appendChild(root)
const instance = new Vue({
const instance = new Vue<any>({
data() {
return { count: 0 }
},

View File

@@ -6,13 +6,19 @@ import {
ComponentOptions,
createComponentInstance
} from '@vue/renderer-dom'
import { MergedComponent } from '../../core/src/component'
class Vue extends Component {
class Vue<
P extends object = {},
D extends object = {},
M extends object = {},
C extends object = {}
> extends Component {
static h = h
static render = render
static nextTick = nextTick
constructor(options: ComponentOptions & { el?: any }) {
constructor(options: ComponentOptions<P, D, M, C> & { el?: any }) {
super()
if (!options) {
return
@@ -43,5 +49,9 @@ class Vue extends Component {
}
}
interface Vue<P, D, M, C> {
$mount(el: any): MergedComponent<P, D> & M & C
}
export default Vue
export * from '@vue/renderer-dom'