Skip to content

Is support for TS namespaces possible? #827

Answered by nmn
zaydek asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, this should be possible to do and I don't see any concern with doing so.

The current constraint to ensure stylex.create calls are at the root of a module is primarily to disallow using stylex.create within function calls. We do this to ensure that the compiled output is a static object with strict equality.

The compiler could even support usage within functions and automatically hoist the object out to the root of the module.

All of that said, this will be hard to prioritize for us as we don't use Typescript namespaces (or typescript at all) in our codebases at Meta. Hopefully, this can be a contribution opportunity that someone can pick up.

Replies: 1 comment 1 reply

Comment options

nmn
Jan 2, 2025
Collaborator

You must be logged in to vote
1 reply
@zaydek
Comment options

Answer selected by zaydek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants