Open davidlav opened 4 years ago
Any suggestions/PRs how those can be coupled are welcomed.
In the case where viewModel
is passed as string(moduleId) I doubt, something could be done.
On another note, there are 4 interfaces currently, DialogComponentActivate
, ... that can be used on the VM.
There is a similar problem how to propagate the dialog "output" type from the VM through the service.
Typescript now provides ways to get the types of function parameters: https://www.typescriptlang.org/docs/handbook/utility-types.html#parameterstype Given this functionality I assume this request would be possible.
I'm submitting a feature request
Current behavior: There is not an easy way to enforce type consistency in the data model passed through the
open
function and where it is consumed in the dialog view model'sactivate
andcanActivate
functions.What is the expected behavior? Add a generic type parameter to
open
for typing themodel
(currently themodel
is simply of typeany
). For example:What is the motivation / use case for changing the behavior? The consuming dialog view model would still need to manually type the
model
, as one currently would, but at least there would be a little more security on the other end knowing that what's being passed in is actually of typeCustomer
.