[@std/cbor] [types] Cbor encoding types should allow readonly arrays
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- api
Research direction
Start in the @std/cbor type definitions for CborType, CborStreamInput, and related encoder input types, then run the reproduction with encodeCbor and CborSequenceEncoderStream. Done means readonly number arrays type-check as inputs to both encoding paths without allowing mutation.
Written by the indexing model from the issue text.
Description
Describe the bug
Cbor.CBORType/CborStreamInput/etc doesn't allow ReadonlyArray. These should be allowed to encoders as CBOR encoding methods don't mutate their inputs.
Steps to Reproduce
import * as CBOR from "jsr:@std/cbor";
const arr: ReadonlyArray<number> = [1, 2, 3];
// Argument of type 'readonly number[]' is not assignable to parameter of type 'CborType'.
CBOR.encodeCbor(arr);
const encoder = new CBOR.CborSequenceEncoderStream();
const writer = encoder.getWriter();
// Argument of type 'readonly number[]' is not assignable to parameter of type 'CborStreamInput'.
writer.write(arr);
Expected behavior
These types should be accepted.
Actual behavior
We get a typescript typing error.
Environment
- OS: Ubuntu 26.04
- deno version: 2.8.1
- std version: 0.1.9
- Dominant language
- TypeScript
- Stars
- 3.6k
- Forks
- 685
- Avg merge
- 10d 11m
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from denoland/std
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
bug needs triage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100