Re:Migrating from Vue 2 to Svelte
by Semaphor on Friday December 02, 2022 @12:59AM
(#33827336)
I agree with the rest, but how do you use imported TS enums in your template? Something like this being impossible is regularly a pain point for me:
[ Parent
| on HN ]
Re:Migrating from Vue 2 to Svelte
by Pokerkoffer on Friday December 02, 2022 @02:07AM
(#33827750)
Store a reference to the enum locally then you can use it in templates
Yeah, but that’s an ugly workaround and how I understand what OP was talking about with global enums.
Re:Migrating from Vue 2 to Svelte
by trinovantes on Friday December 02, 2022 @02:35AM
(#33827882)
`ArticleTypes` should be automatically available in the template just from importing it if you use script setup
Otherwise you also need to return it in the setup function (composition) or store a local copy of it in the data field (options)