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
Does it make sense to create our own TypeScript type for how we represent string types?
That we use/share across many of our components, and expose for regular "string types".
The context is that our consumers(applications that use Eufemia) often tend to either provide a "string" or a "React Node"(i.e <FormattedMessage id="app.greeting"/>) to our components. But if we use only string as a type to represent these "string properties", then passing <FormattedMessage id="app.greeting"/> will result in a TS error/warning.
To prevent this we could perhaps have our own type that we share/use in these scenarios(which I believe is many) 🤔
The text was updated successfully, but these errors were encountered:
langz
changed the title
Does it make sense to create our own TypeScript type for how we represent string values?
Does it make sense to create our own TypeScript type for how we represent string types?
Mar 22, 2023
Does it make sense to create our own TypeScript type for how we represent string types?
That we use/share across many of our components, and expose for regular "string types".
The context is that our consumers(applications that use Eufemia) often tend to either provide a "string" or a "React Node"(i.e
<FormattedMessage id="app.greeting"/>
) to our components. But if we use onlystring
as a type to represent these "string properties", then passing<FormattedMessage id="app.greeting"/>
will result in a TS error/warning.To prevent this we could perhaps have our own type that we share/use in these scenarios(which I believe is many) 🤔
The text was updated successfully, but these errors were encountered: