clone the repo and do yarn followed by a yarn serve, open the browser.
The test case is in App.vue
What is expected?
MyComponent1 which is a correctly typed AsyncComponent should render. It contains a component property which is of type AsyncComponentPromise which is a fonction that returns a promise.
MyComponent2 which is incorrectly typed as component is of type Promise<EsModuleComponent> should not load properly.
What is actually happening?
The opposite.
This is due to this line
which checks wether component is a promise, not a function which returns a promise.
Among the two ways this could be fixed :
component could be of type Promise<Component | EsModuleComponent> instead of the maybe confusingly named AsyncComponentPromise. Or resolveAsyncComponent could have a third case where if res.component is of type Function, it should call res.component(resolve, reject) and test if -that- is a promise before failing.
The text was updated successfully, but these errors were encountered:
Version
2.6.11
Reproduction link
https://github.com/Esurnir/repro-types-vue
Steps to reproduce
clone the repo and do yarn followed by a yarn serve, open the browser.
The test case is in App.vue
What is expected?
MyComponent1
which is a correctly typedAsyncComponent
should render. It contains a component property which is of typeAsyncComponentPromise
which is a fonction that returns a promise.MyComponent2
which is incorrectly typed ascomponent
is of typePromise<EsModuleComponent>
should not load properly.What is actually happening?
The opposite.
This is due to this line
which checks wether component is a promise, not a function which returns a promise.
Among the two ways this could be fixed :
component could be of type
Promise<Component | EsModuleComponent>
instead of the maybe confusingly named AsyncComponentPromise. Or resolveAsyncComponent could have a third case where if res.component is of type Function, it should call res.component(resolve, reject) and test if -that- is a promise before failing.The text was updated successfully, but these errors were encountered: