Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it make sense to create our own TypeScript type for how we represent string types? #2142

Open
langz opened this issue Mar 22, 2023 · 0 comments

Comments

@langz
Copy link
Contributor

langz commented 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 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) 🤔

@langz 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant