Skip to content

Consider simplifying type exports and require moduleResolution: bundler #280

@gunters63

Description

@gunters63

Describe the bug

(Some) Ladle Types cannot be resolved correctly with Node16 resolution

Reproduction

  • pnpm create vite my-react-app --template react-ts
  • pnpm i
  • Add a story using a decorator, the example from the website is sufficient:
import type { Story, StoryDecorator } from "@ladle/react";

export default {
  decorators: [
    (Component, context) => (
      <div style={{ margin: "3em" }}>
        {context.globalState.control.label.value}
        <Component />
      </div>
    ),
  ] as StoryDecorator[],
};

const Card: Story<{
  label: string;
}> = ({ label }) => <p>Label: {label}</p>;

Card.args = {
  label: "Hello",
};
  • pnpm tsc --noemit shows no errors:
  • Change node resolution to Node16 in tsconfig.json
  • pnpm tsc --noemit shows now errors:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions