Closed whitetrefoil closed 6 years ago
As far as I can tell, these 3 items aren't fixable in TypeScript design. I think we should let them be there.
Hoping new features will come in future versions of TS. (although it has already been very complex)
Just found there may have other legal arguments for the next functions, will take a look at them. Hold this PR...
Should I install vue-router
as dependency then use NavigationGuard
from it directly?
I copied some definition code from vue-router, now the next function can accept different types(callback, false
, Location
) of arguments at same time. (like in README)
I personally prefer code duplication over importing a whole library. Is this pull request good to go?
Me too. I've tried installing vue-router first, and compiled successfully.
But I had problem when install the compiled code as dependency in other projects - tsc said cannot found stuff av-ts imported from external libs (vue & vue-router). As a result I cannot test my changes.
So for safety purpose, I copied the code from vue-router instead of import types from it.
I merged some next functions, but I still cannot find proper way to fix:
NextFunc
orNextFuncVm
forbeforeRouteEnter
.MyComponent
forNextFuncVm<MyComponent>
.Cannot set
this
inbeforeRouteEnter
tovoid
: