You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
We're currently in the process of strictly typing our templates, and we have to make an ugly workaround for the DndDropEvent since it's data property is typed any instead of a generic T.
Describe the solution you'd like
Being able to assume a type in handler-functions, such as onDrop(event: DndDropEvent<MyDataType>), in which event gets the property data: MyDataType instead of data: any.
Describe alternatives you've considered
An alternative would be to use the type property (which is typed with any as well) and a switch-case to check whether or not we can use as to convert the data to the correct type. Another alternative I've considered is to create interfaces that have the exact properties we have on the relevant types, and perform instanceof checks.
We can't use Angular Material Drag & Drop for dragging, since the lists are nested and it doesn't support nested lists. However, Angular Material does have the option to type the data property of the event.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
We're currently in the process of strictly typing our templates, and we have to make an ugly workaround for the
DndDropEvent
since it'sdata
property is typedany
instead of a genericT
.Describe the solution you'd like
Being able to assume a type in handler-functions, such as
onDrop(event: DndDropEvent<MyDataType>)
, in whichevent
gets the propertydata: MyDataType
instead ofdata: any
.Describe alternatives you've considered
An alternative would be to use the
type
property (which is typed withany
as well) and a switch-case to check whether or not we can useas
to convert the data to the correct type. Another alternative I've considered is to create interfaces that have the exact properties we have on the relevant types, and performinstanceof
checks.We can't use Angular Material Drag & Drop for dragging, since the lists are nested and it doesn't support nested lists. However, Angular Material does have the option to type the
data
property of the event.The text was updated successfully, but these errors were encountered: