Thinkmill / Thinkmill/keystatic

Incompatible types between CloudImageProps and actual component props

Open
#600 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.4k
Forks
159
Avg merge
21h 41m
Merged PRs (30d)
2

Description

I was testing our new CloudImageProps type and it turns out it's incompatible with the types the component block actually provides 🤦

Type '({ src, alt, height, width }: CloudImageProps) => Element' is not assignable to type 'Comp<{ readonly src: string; readonly alt: string; readonly height: number | null; readonly width: number | null; }>'.
  Types of parameters '__0' and 'props' are incompatible.
    Type '{ readonly src: string; readonly alt: string; readonly height: number | null; readonly width: number | null; }' is not assignable to type 'CloudImageProps'.
      Types of property 'width' are incompatible.
        Type 'number | null' is not assignable to type 'number | undefined'.
          Type 'null' is not assignable to type 'number | undefined'.

When I define this type locally in the project, it's fine:

type CloudImageProps = {
  src: string;
  alt: string;
  height: number;
  width: number;
};

We should update the type we're exporting to allow for the null / undefined clash, so people don't have to type this locally.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the exported CloudImageProps definition and the component block's props type, then compare the nullability of src, alt, height, and width. Confirm the exported type accepts the props the component actually provides, and verify the TypeScript incompatibility is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.