sapphiredev/shapeshift

bug: Type 'T' does not satisfy the constraint 'object'

kieran-s opened this issue · 3 comments

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

https://stackoverflow.com/questions/73761953/sapphire-shapeshift-discordjs-type-t-does-not-satisfy-the-constraint-objec

Using DiscordJS and typescript, when I try to build using TSC, I get errors in sapphire/shapeshift

node_modules/@sapphire/shapeshift/dist/index.d.ts:590:44 - error TS2344: Type 'T' does not satisfy the constraint 'object'.

590 declare type SchemaOf<T> = ObjectValidator<T>;
                                               ~

  node_modules/@sapphire/shapeshift/dist/index.d.ts:590:23
    590 declare type SchemaOf<T> = ObjectValidator<T>;
                              ~
    This type parameter might need an `extends object` constraint.

node_modules/@sapphire/shapeshift/dist/index.d.ts:641:65 - error TS2344: Type 'T' does not satisfy the constraint 'object'.

641     object<T>(shape: MappedObjectValidator<T>): ObjectValidator<T, UndefinedToOptional<T>>;
                                                                    ~

  node_modules/@sapphire/shapeshift/dist/index.d.ts:641:12
    641     object<T>(shape: MappedObjectValidator<T>): ObjectValidator<T, UndefinedToOptional<T>>;
                   ~
    This type parameter might need an `extends object` constraint.


Found 2 errors in the same file, starting at: node_modules/@sapphire/shapeshift/dist/index.d.ts:590

Steps To Reproduce

  1. Setup a project using DiscordJS14 and typescript
  2. Build using TSC

Expected behavior

Builds properly

Screenshots

No response

Additional context

No response

Duplicate of #193

check the reply in that issue

favna commented

Closing as per the above comment

Ah thanks, missed that issue!
Using yarn resolutions per that reply fixed it.