GenSpectrum / dashboard-components

https://genspectrum.github.io/dashboard-components/
GNU Affero General Public License v3.0
2 stars 0 forks source link

Export types #248

Open chaoran-chen opened 3 months ago

chaoran-chen commented 3 months ago

It would be great if we could export the types of input and event values. For example, this would be very useful here:

https://github.com/GenSpectrum/dashboards/blob/432a7edf883cbdae19ee67fc5aebd9558d9b98e6/examples/React/src/App.tsx#L6-L13

With the types, we can write e.g. useState<LapisLocation>()

And instead of just using a CustomEvent, it would be great to have a more specific event:

https://github.com/GenSpectrum/dashboards/blob/432a7edf883cbdae19ee67fc5aebd9558d9b98e6/examples/React/src/App.tsx#L16

fengelniederhammer commented 3 months ago

And instead of just using a CustomEvent, it would be great to have a more specific event:

Should we create a new child class of CustomEvent then?

chaoran-chen commented 3 months ago

Or just specify it as CustomEvent<...>?

fengelniederhammer commented 3 months ago

We already do that where it's relevant:

https://github.com/GenSpectrum/dashboards/blob/cf57ea6686cf38dbe5d1b31b3c3c763010977688/components/src/web-components/input/gs-location-filter.tsx#L20

https://github.com/GenSpectrum/dashboards/blob/cf57ea6686cf38dbe5d1b31b3c3c763010977688/components/src/web-components/input/gs-location-filter.tsx#L70