hookable icon indicating copy to clipboard operation
hookable copied to clipboard

Type 'HooksT' does not satisfy the constraint 'Record<string, any>'

Open Vinccool96 opened this issue 2 years ago • 4 comments

Environment

Node: 16.17.1
typescript: 4.9.4
hookable: 5.4.2

Reproduction

Minimal reproduction

Run yarn run build or tsc.

Describe the bug

A PR for this issue will be submitted

When compiling with tsc, everything gets compiled correctly, but we receive this error message:

node_modules/hookable/dist/index.d.ts:65:49 - error TS2344: Type 'HooksT' does not satisfy the constraint 'Record<string, any>'.

65     beforeEach(function_: (event: InferSpyEvent<HooksT>) => void): () => void;
                                                   ~~~~~~

  node_modules/hookable/dist/index.d.ts:46:24
    46 declare class Hookable<HooksT = Record<string, HookCallback>, HookNameT extends HookKeys<HooksT> = HookKeys<HooksT>> {   
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This type parameter might need an `extends Record<string, any>` constraint.

node_modules/hookable/dist/index.d.ts:66:48 - error TS2344: Type 'HooksT' does not satisfy the constraint 'Record<string, any>'.

66     afterEach(function_: (event: InferSpyEvent<HooksT>) => void): () => void;
                                                  ~~~~~~

  node_modules/hookable/dist/index.d.ts:46:24
    46 declare class Hookable<HooksT = Record<string, HookCallback>, HookNameT extends HookKeys<HooksT> = HookKeys<HooksT>> {
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This type parameter might need an `extends Record<string, any>` constraint.


Found 2 errors in the same file, starting at: node_modules/hookable/dist/index.d.ts:65

error Command failed with exit code 2.

Additional context

No response

Logs

No response

Vinccool96 avatar Dec 11 '22 21:12 Vinccool96