Skip to content

Compilation error on index.d.cts #488

Closed as not planned
Closed as not planned
@JbIPS

Description

@JbIPS

Bug Report

On a project with deepmerge-ts as a depency and skipLibCheck to false, this error pops at compile time

> tsc -p .

node_modules/deepmerge-ts/dist/node/index.d.cts:437:127 - error TS2344: Type '{ 
[I in keyof Ts]: Ts[I] extends { key: infer Key extends PropertyKey; values: inf
er Values extends readonly unknown[]; optional: infer O extends boolean; } ? Cre
ateRecordForKeyFromMeta<Key, Values, O, Fs, M> : never; }' does not satisfy the 
constraint 'readonly unknown[]'.
  Types of property 'length' are incompatible.
    Type 'Ts["length"] extends { key: infer Key extends PropertyKey; values: inf
er Values extends readonly unknown[]; optional: infer O extends boolean; } ? Cre
ateRecordForKeyFromMeta<Key, Values, O, Fs, M> : never' is not assignable to typ
e 'number'.
      Type '{ [x: string]: unknown; [x: number]: unknown; [x: symbol]: unknown; 
} | { [x: string]: unknown; [x: number]: unknown; [x: symbol]: unknown; }' is no
t assignable to type 'number'.
        Type '{ [x: string]: unknown; [x: number]: unknown; [x: symbol]: unknown
; }' is not assignable to type 'number'.

437 type CreateRecordFromMeta<Ts, Fs extends DeepMergeFunctionsURIs, M> = Ts ext
ends ReadonlyArray<unknown> ? TupleToIntersection<{
                                                                                
                                                  ~
438     [I in keyof Ts]: Ts[I] extends {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
442     } ? CreateRecordForKeyFromMeta<Key, Values, O, Fs, M> : never;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
443 }> : never;

Expected behavior

It should compile

Actual behavior

It does not

Steps to reproduce

  • npm i deepmerge-ts@latest (7.0.3 is also affected)
  • ensure in tsconfig.json that you have "skipLibCheck": false
  • `tsc

Proposed changes

Adding "skipLibCheck": false on the main project is a workaround, but I find it a bit hacky, thus this report

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Awaiting ResponseIssue or PR awaits response from the creator.Status: StaleThere has not been activity on this issue or PR for quite some time.Type: BugInconsistencies or issues which will cause a problem for users or implementors.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions