mirror of
https://github.com/denoland/std.git
synced 2024-11-21 12:40:03 +00:00
fix(msgpack): accept readonly input data in encode()
(#5832)
feat(msgpack): accept readonly input data (#5831)
This commit is contained in:
parent
64d80042b1
commit
15fc72c273
@ -13,7 +13,7 @@ export type ValueType =
|
||||
| boolean
|
||||
| null
|
||||
| Uint8Array
|
||||
| ValueType[]
|
||||
| readonly ValueType[]
|
||||
| ValueMap;
|
||||
|
||||
/**
|
||||
|
@ -214,3 +214,15 @@ Deno.test("encode() throws when the object is an instance of a custom class", ()
|
||||
"Cannot safely encode value into messagepack",
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("encode() accepts `as const` data", () => {
|
||||
const data = {
|
||||
a: 1,
|
||||
b: { c: 2 },
|
||||
d: [3, { e: 4 }],
|
||||
} as const;
|
||||
|
||||
void (() => {
|
||||
encode(data);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user