Checker rejects an ArrayBuffer constructor result for an ArrayBuffer parameter

Open
#3,827 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
57/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp, typescript
Domain
compilers

Research direction

Start with the type checker path that validates function arguments and compare how it handles the parameter’s ArrayBuffer type with the type of new ArrayBuffer(1). Run the repro with sharpts --no-tsconfig repro.ts and compare it with tsc --noEmit repro.ts. Done when SharpTS accepts the call, matching TypeScript 5.9.3.

Written by the indexing model from the issue text.

Description

A plain ArrayBuffer parameter rejects a newly constructed ArrayBuffer with the default library enabled.

function accept(buffer: ArrayBuffer): void {}
accept(new ArrayBuffer(1));

TypeScript 5.9.3 accepts this with tsc --noEmit repro.ts. SharpTS reports Argument 1 expected type 'interface ArrayBuffer' but got 'interface ArrayBuffer' when run as sharpts --no-tsconfig repro.ts. Reproduced with the #3820 build while checking #3819.

Dominant language
C#
Stars
156
Forks
4
Avg merge
14h 45m
Merged PRs (30d)
40

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nickna/SharpTS

All issues in nickna/SharpTS

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.