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.
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
chore: migrate @fluentui/react-components #20749
chore: migrate @fluentui/react-components #20749
Changes from 7 commits
8299f41
00da790
4e78153
f2f5f26
f4359dd
7ccebc6
cbecc87
13cb126
3a7fd31
0047238
f972dcf
135f847
a6738f9
95fe527
c24a859
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Hotell Now Node typings are leaking to stories, not sure that it's okay 😯 Is it happens because non all packages were migrated yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so because the custom logic that is being provided in root
/.storybook
and inreact-components
- (main.utils.js), which usesnode
APIs, node typings are being included to the checking program ( which is how TS works ). At this point there is no functionality that allows us to prevent that.Only solution is to be explicit and stop doing antipatterns like accesing globals directly.
Instead:
Do:
This will resolve the type issues you're having.
Another thingy:
Now because I introduced tests in
react-components/.storybook
, we would need to addjest
glboals toreact-components/.storybook/tsconfig.json
. That will pollute all stories, thus allowing anyone to use jest globals in stories. I don't think that's the proper solution ATM, so instead we can do following for that test file:@filename react-components/.storybook/main.utils.test.js +/// <reference types="jest" /> const utils = require('./main.utils'); describe(`main utils`, () => {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is using
<reference types="jest" />
is a practice that we should follow in such cases?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideal scenario is to have this in separate package (logic,tests) with proper globals set. but as a temporary workaround/corner case I think so, yes.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also going forward ( once we migrate to jest 27 ) we should stop using globals as jest provides imports for their API ( one less global in our lives yay )