-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, this should be possible to do and I don't see any concern with doing so. The current constraint to ensure 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. |
Beta Was this translation helpful? Give feedback.
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 usingstylex.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.