You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
933 B
44 lines
933 B
import Vue, { AsyncComponent, Component } from "../index";
|
|
|
|
const a: AsyncComponent = () => ({
|
|
component: new Promise<Component>((res, rej) => {
|
|
res({ template: "" })
|
|
})
|
|
})
|
|
|
|
const b: AsyncComponent = () => ({
|
|
// @ts-expect-error component has to be a Promise that resolves to a component
|
|
component: () =>
|
|
new Promise<Component>((res, rej) => {
|
|
res({ template: "" })
|
|
})
|
|
})
|
|
|
|
const c: AsyncComponent = () =>
|
|
new Promise<Component>((res, rej) => {
|
|
res({
|
|
template: ""
|
|
})
|
|
})
|
|
|
|
const d: AsyncComponent = () =>
|
|
new Promise<{ default: Component }>((res, rej) => {
|
|
res({
|
|
default: {
|
|
template: ""
|
|
}
|
|
})
|
|
})
|
|
|
|
const e: AsyncComponent = () => ({
|
|
component: new Promise<{ default: Component }>((res, rej) => {
|
|
res({
|
|
default: {
|
|
template: ""
|
|
}
|
|
})
|
|
})
|
|
})
|
|
|
|
// Test that Vue.component accepts any AsyncComponent
|
|
Vue.component("async-compponent1", a)
|
|
|