Skip to content
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

Merged
merged 5 commits into from
Aug 21, 2024
Merged

Adds MetaJson types #568

merged 5 commits into from
Aug 21, 2024

Conversation

hiddenist
Copy link
Contributor

@hiddenist hiddenist commented Aug 2, 2024

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.

Copy link

changeset-bot bot commented Aug 2, 2024

🦋 Changeset detected

Latest commit: e6e61b4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@ladle/react Patch
example Patch
test-addons Patch
test-babel Patch
test-config Patch
test-config-ts Patch
test-css Patch
test-decorators Patch
test-playwright Patch
test-programmatic Patch
test-provider Patch
test-baseweb Patch
test-msw Patch

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;
Copy link
Owner

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

Copy link
Contributor Author

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:
image

I think I have something that should work though, so let's see what you think.

Copy link
Contributor Author

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?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@hiddenist hiddenist requested a review from tajo August 7, 2024 20:06
@tajo tajo merged commit b6d0f10 into tajo:main Aug 21, 2024
2 checks passed
@tajo tajo mentioned this pull request Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants