fix: export additional types to enable TypeScript declaration builds #1095
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:(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):After changes:
(no error 😃)
Linked PR/Issues
Fixes #1070
Additional Context
In theory I see that there's a
example-nextjs
with directory namedtypesets
but I see them being already broken (importing from the removedlib/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
Contribution Guidelines