Closed russelldavis closed 1 year ago
N/A
No response
macOS
The return value of deepmerge is incorrect when the inputs contain a readonly array.
deepmerge
import makeDeepmerge from "@fastify/deepmerge"; const deepmerge = makeDeepmerge(); const a1 = ['a', 'b'] as const; const a2 = ['c'] as const; const m = deepmerge(a1, a2);
The type of m is readonly ["c"] which is incorrect.
m
readonly ["c"]
The type of m should be ["a" | "b" | "c"] (or even better, ["a", "b", "c"] in this case since the inputs are tuples).
["a" | "b" | "c"]
["a", "b", "c"]
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.
Prerequisites
Fastify version
N/A
Plugin version
No response
Node.js version
N/A
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
N/A
Description
The return value of
deepmerge
is incorrect when the inputs contain a readonly array.Steps to Reproduce
The type of
m
isreadonly ["c"]
which is incorrect.Expected Behavior
The type of
m
should be["a" | "b" | "c"]
(or even better,["a", "b", "c"]
in this case since the inputs are tuples).