measuredco / puck

The visual editor for React
https://puckeditor.com
MIT License
5.04k stars 279 forks source link

Type errors with TypeScript strict mode #575

Closed chrisvxd closed 1 week ago

chrisvxd commented 3 weeks ago

Users have reported errors when using TS strict mode:

Steps to reproduce

Create a project with TypeScript strict mode enabled, and the following type definition:

type RootProps = {
    font: string;
    children: ReactNode;
} & DefaultRootProps;

type PuckConfig = Config<Components, RootProps>;

What happened

The following building error occurs:

Type 'PuckConfig' does not satisfy the constraint 'Config'.
  Types of property 'root' are incompatible.

What I expected to happen

No build error to occur

IMythx commented 3 weeks ago

doesnt PR#548 fix that error?

chrisvxd commented 3 weeks ago

Sorry @IMythx - I've been meaning to review #548. It might fix the error but it changes the types in a way that we don't necessarily want by just making them looser. Will need a bit further investigation.

IMythx commented 3 weeks ago

Sorry @IMythx - I've been meaning to review #548. It might fix the error but it changes the types in a way that we don't necessarily want by just making them looser. Will need a bit further investigation.

Ok got it

chrisvxd commented 2 weeks ago

@IMythx could you confirm if 0.16.0-canary.6d43ba0 (from #592) addresses your vite issues?

IMythx commented 2 weeks ago

@IMythx could you confirm if 0.16.0-canary.6d43ba0 (from #592) addresses your vite issues?

yeah it did fix the issue with strict mode on Thx