-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
TypeScript migration: @storybook/channels #4977
Conversation
Codecov Report
@@ Coverage Diff @@
## next #4977 +/- ##
=========================================
- Coverage 34.85% 34.7% -0.16%
=========================================
Files 579 589 +10
Lines 7038 7262 +224
Branches 943 984 +41
=========================================
+ Hits 2453 2520 +67
- Misses 4082 4239 +157
Partials 503 503
Continue to review full report at Codecov.
|
Rewrote all tests in order to reflect the actual usage of this package Coverage is almost 100% - I don't know how to test Also, the whole package is type safe - no |
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.
Awesome PR and work! Have some question regarding different aspects of TS and implementation. Would definitely like to help out with this! 😃
|
||
export interface ChannelEvent<TEventArgs = any> { | ||
type: string; // eventName | ||
from: string; |
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.
Same goes for the from
field similar to the type
field, see comment above.
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.
Yeah should be either manager
or preview
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.
How can it be manager or preview if you check this
const event: ChannelEvent<TEventArgs[]> = { type: eventName, args, from: this.sender };
Where this.sender
is
private sender = generateRandomId();
and the function does
const generateRandomId = () => {
// generates a random 13 character string
return Math.random()
.toString(16)
.slice(2);
};
Either we rewrite some stuff or I can't do this:
from: 'preview' | 'manager';
due to type checking errors (all hail typescript 😄 )
We need to NOT test this file: |
hmm
and
|
Ready to merge? |
Yes, I still need feedback from you regarding the |
Issue: N/A
What I did
Migrated
@storybook/channels
to TypeScriptHow to test
Tests are included - currently almost 100% coverage. Test for
async: true
is missing