Skip to content

Nextjs-Vite: Export interface declaration for NextPreview#33785

Merged
valentinpalkovic merged 1 commit into
storybookjs:nextfrom
icopp:patch-5
Feb 6, 2026
Merged

Nextjs-Vite: Export interface declaration for NextPreview#33785
valentinpalkovic merged 1 commit into
storybookjs:nextfrom
icopp:patch-5

Conversation

@icopp
Copy link
Copy Markdown
Contributor

@icopp icopp commented Feb 6, 2026

This interface has to be exported to prevent "cannot be named" errors when attempting to export any object made with definePreview.

On a side note here, since I've run into this problem with different types in Storybook repeatedly, I think the basic issue here for the maintainers to keep in mind is:

For use in Typescript projects with all the strictness stuff turned on, especially cases like monorepos, packages must export every type and interface used by any other export. It doesn't matter if you expect people to use that type or interface directly, it has to be exported to work right for any kind of complex Typescript setup.

What I did

This interface has to be exported to prevent "cannot be named" errors when attempting to export any object made with definePreview.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

  • Create preview.tsx in a Typescript repo with strict everything
  • Attempt to create and export definePreview
  • Without these changes, there is an error
  • With this, the error goes away

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • New Features
    • Expanded the public API surface for framework integration, enabling developers to directly access previously internal interfaces.

This interface has to be exported to prevent "cannot be named" errors when attempting to export any object made with `definePreview`.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

The pull request adds the export modifier to the NextPreview interface in the NextJS Vite framework entry point, making it a public module export while preserving its generic signature and inheritance structure.

Changes

Cohort / File(s) Summary
Framework Type Export
code/frameworks/nextjs-vite/src/index.ts
Added export modifier to NextPreview interface to make it a public export, changing from internal to publicly accessible type.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@valentinpalkovic valentinpalkovic self-assigned this Feb 6, 2026
@valentinpalkovic valentinpalkovic moved this to In Progress in Core Team Projects Feb 6, 2026
@valentinpalkovic valentinpalkovic added typescript ci:normal Run our default set of CI jobs (choose this for most PRs). labels Feb 6, 2026
@valentinpalkovic valentinpalkovic changed the title fix: export interface declaration for NextPreview in nextjs-vite Nextjs-Vite: Export interface declaration for NextPreview Feb 6, 2026
@valentinpalkovic valentinpalkovic merged commit dfb8135 into storybookjs:next Feb 6, 2026
15 of 21 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Core Team Projects Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal Run our default set of CI jobs (choose this for most PRs). typescript

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants