-
Notifications
You must be signed in to change notification settings - Fork 47
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
Sound arg types for CSF3 #49
Conversation
2d87323
to
ee23c22
Compare
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.
LGTM, I have a couple questions for my own clarification, and one minor suggestion.
src/story.ts
Outdated
|
||
export type StoryAnnotations< | ||
TFramework extends AnyFramework = AnyFramework, | ||
TArgs = Args | ||
TArgs = Args, | ||
TArgsAnnotations = Partial<TArgs> |
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.
TArgsAnnotations = Partial<TArgs> | |
TRequiredArgs = Partial<TArgs> |
This is more intuitive to me, what do you think?
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.
Sounds good to me, what do you think @shilman?
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.
Works for me. Also discussed TRemainingArgs
because these args are not necessarily required. But agree that "required" is the most readable/clear
191b0c0
to
9d84710
Compare
ArgsFromMeta utility and generic ArgsStoryFn RT
🚀 PR was released in |
Strict args
Added a third argument, for the args that need to be annotated for a story (which may be different then "all" the args, which is TArgs). This allows frameworks to provide strict args without specifying args that are already filled in automagically.
Strict component in meta:
Made AnyFramework dependent on a generic parameter T, which makes sure we can use the Framework['component'] with different generic values ( we use any/unknown,TArgs).
This ensures that the component provided in meta, must match
TArgs
, while subcomponents and other references ofFramework['component']
stay more generic.Strict decorators/loaders:
Loaders and decorators are now dependent on TArgs, which means you get auto-completion and typesafety when using args.
📦 Published PR as canary version:
0.0.2--canary.49.65292c2.0
✨ Test out this PR locally via: