Closed eps1lon closed 5 years ago
Jss constructor is a private API, it is used by create
function in the package and those options are public
Same like StyleSheet is private, but createStyleSheet is public
Sure the constructor is private and I'm not asking about the options I pass to create
.
const jss = create();
// do I access private variables here that can be removed at any time without a major release?
const { createGenerateClassName } = jss.options;
Yes
On Tue, Aug 21, 2018, 07:21 Sebastian Silbermann notifications@github.com wrote:
Sure the constructor is private and I'm not asking about the options I pass to create.
const jss = create(); // do I access private variables here that can be removed at any time without a major release?const { createGenerateClassName } = jss.options;
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cssinjs/jss/issues/828#issuecomment-414553087, or mute the thread https://github.com/notifications/unsubscribe-auth/AADOWP0NRUhC7A-J06nhe-kypQaKGpchks5uS5jUgaJpZM4WElv9 .
Why would you need to access those?
We are now exporting atleast some of the flow types from jss to be used by plugins and Integrations.
In the case of the Jss class: We are exporting only the type of the class and the Options for the constructor
So why does react-jss
depend on those private variables? I realize that this sounds purely academic since react-jss
is tightly coupled with jss
on purpose but it kind of blocks typescript definitions over at DefinitelyTyped. Or I just require typeof Jss
to communicate the tight coupling between those two. Sorry about the unrelated ramble 😄 Appreciate your help.
@HenriBeck I don't. react-jss
does
https://github.com/cssinjs/react-jss/blob/06044cbf8e7596c30f03573605567f42fa1b0763/src/propTypes.js#L5
https://github.com/cssinjs/react-jss/blob/06044cbf8e7596c30f03573605567f42fa1b0763/src/JssProvider.js#L58
Ohhh, I see what you mean.
Yes, react-jss is obviously tightly coupled to jss itself.
You shouldn’t need those things for only the ts types though.
I think we could avoid using jss.options there as well.
As far as I'm concerned this is resolved. Going to close this. Thank you for your time @kof and @HenriBeck :+1:
Neither feature nor bug report. More a question for the maintainers considering the public API.
Currently
Jss#options
is not documented in the API docs and the typing (InternalJSSOptions
) also indicates that these should not be used. Howeverreact-jss
currently requiresoptions.createGenerateClassName
to be visible.I'm currently working on ts definitions for
react-jss
and would like to know if this requires a change to the definitions forjss
as well.