Skip to content

type check doesn't run for styled-components #3515

@miyacoz

Description

@miyacoz
  • Check if updating to the latest Preact version resolves the issue

Describe the bug
before starting, i'm honestly not sure if this's a bug or it's me doing something wrong, especially about typescript settings with preact, so i want you to check the configure in the repro code below first.

hi, i found tsc somehow didn't return a type error that i expected for components using styled-components in my private preact project.
it checks non-styled components properly and returns a result as intended, also the issue doesn't happen in a react project with the same source (though the settings are kinda different as you see in my repro code).

i know preact isn't 100% compatible with react in typing as well, so am kinda reckoning it causes the problem but haven't dug down preact's .d.ts and else.

To Reproduce

here's the repro code: miyacoz/preact-styled-repro
please note there're master branch with preact where the problem is happening, and react branch with react where everything's fine (= tsc properly emitting type errors).

Steps to reproduce the behavior:

  1. clone the repro code
  2. yarn start then tsc starts
  3. confirm tsc doesn't point out <Styled> having an error

also compare the result with react one (don't forget yarn install after checking out).

Expected behavior
tsc properly reports type errors.
in my repro code, it points out type errors with both <Styled> and <Component>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions