-
Notifications
You must be signed in to change notification settings - Fork 99
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
Adds MetaJson types #568
Adds MetaJson types #568
Conversation
🦋 Changeset detectedLatest commit: e6e61b4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
export type MetaJsonStory<M = any> = { | ||
name: string; | ||
levels: string[]; | ||
meta: M; |
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.
Can this be made stricter, an extension of this type https://github.com/tajo/ladle/blob/main/packages/ladle/lib/app/exports.ts#L138
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 this is what I wanted to do, but it's a bit awkward since Meta is defined in the app exports but these types are in the shared types.
I would just move the Meta interface over into the shared types and re-export it but I get a conflict with this Meta const:
I think I have something that should work though, so let's see what 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.
@tajo How about this implementation?
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'm using visual snapshots in my project, and our TypeScript rules in the project dictate that I needed to define the type for the shape of the meta.json file.
I figured it might be a good idea to formally define these types in the project and export them for consumers of the library in case the shape changes in the future.