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

Export DataType #138

Closed
j-m opened this issue Aug 31, 2021 · 4 comments
Closed

Export DataType #138

j-m opened this issue Aug 31, 2021 · 4 comments
Milestone

Comments

@j-m
Copy link

j-m commented Aug 31, 2021

I was wondering whether it'd be possible for the package to export its DataType namespace, please? Or is there a reason not to?

I think it'd be pretty useful, for example, I'm wanting to limit the prop values of alignItems and justifyContent to be just DataType.ContentPosition | DataType.ContentDistribution.
The existing type doesn't really limit the prop values as it uses | string: export type JustifyContent = Globals | DataType.ContentDistribution | DataType.ContentPosition | "left" | "normal" | "right" | (string & {});

I had a quick search through the issues and only found this unanswered question:

Also, what's the rationale for not exporting the DataType namespace?
Originally posted by @buschtoens in #131 (comment)

@frenic frenic added this to the Version 3.1 milestone Sep 13, 2021
@frenic
Copy link
Owner

frenic commented Sep 13, 2021

Those data types receives its name from the spec. E.g. <color> becomes DataType.Color and <content-distribution> becomes DataType.ContentDistribution. It happens quite frequent that these data types are split into several data types or/and name changes as the spec develops. So there's a risk that a minor/patch update from csstype can break your typing if you're using the DataType namespace. But it's easily solved by updating the csstype dependency in package.json and change to the correct data type. So I can add a JSdoc comment about these risks and export it.

@j-m
Copy link
Author

j-m commented Sep 13, 2021

Makes sense.
Sounds perfect, yes please!

@paulorgl
Copy link

@frenic do we already have a forecast of when this will be available for use?

@frenic frenic closed this as completed in 22f3c89 May 16, 2022
@frenic
Copy link
Owner

frenic commented May 16, 2022

Published in [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants