8000 fix: export additional types to enable TypeScript declaration builds by pawelblaszczyk5 · Pull Request #1095 · facebook/stylex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: export additional types to enable TypeScript declaration builds #1095

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pawelblaszczyk5
Copy link

What changed / motivation ?

It was discussed a bit here: #1070

For generating declarations by TypeScript all types that would be needed by the output needs to be exported so it can properly reference them in d.ts file. It's really important to works correctly for e.g. in monorepo scenarios where part of your code can live in a separate package.

These two types are used by the output of styles.create calls - you can observe this by hovering styles created with this function call. Example:

image

(this is slightly modified fragment of code inside of repository examples/example-nextjs/typetests/theming)

Hence TypeScript couldn't generate the same type as in hover in d.ts file - because these types aren't exported from the latest release.

Before changes (NOTE: I had to enable declaration in tsconfig of this example to observe this error):

image

After changes:

image

(no error 😃)

Linked PR/Issues

Fixes #1070

Additional Context

In theory I see that there's a example-nextjs with directory named typesets but I see them being already broken (importing from the removed lib/StyleXTypes entry point. And not being verified anywhere. If you'd like me to create examples for cases which this change fixes inside of repo just let me know where I can place them. Thanks a lot in advance!

Pre-flight checklist

@facebook-github-bot
Copy link

Hi @pawelblaszczyk5!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 10, 2025
@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript error while using stylex.create after 0.13.0 update - the inferred type cannot be named without a reference
2 participants
0