ITADN

Compilation error on index.d.cts

#488ClosedJbIPS 创建于 2024-07-23
Status: Awaiting ResponseType: BugStatus: Stale
J
JbIPScommented
## Bug Report On a project with `deepmerge-ts` as a depency and `skipLibCheck` to `false`, this error pops at compile time ```sh > 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
关闭于 2024-12-16 5 条评论