Skip to content

fix(dts): Update type of ArrayBuffer #54636

Closed
@indrajitbnikam

Description

@indrajitbnikam

lib Update Request

The problem is that proper types are not available when Resizable ArrayBuffer need to be created by passing options in the constructor.

Configuration Check

My compilation target is ESnext and my lib is the default.

Missing / Incorrect Definition

ArrayBuffer Constructor signature.

Sample Code

const buff = new ArrayBuffer(10, {
  maxByteLength: 100,
});

console.debug(buff.resizable);
console.debug(buff.byteLength);

buff.resize(100);
console.debug(buff.byteLength);

Documentation Link

You can check the signature over here.

ArrayBuffer() constructor

Activity

added
Working as IntendedThe behavior described is the intended behavior; this is not a bug
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScript
BugA bug in TypeScript
and removed
Working as IntendedThe behavior described is the intended behavior; this is not a bug
on Jun 14, 2023
added this to the Backlog milestone on Jun 14, 2023
RyanCavanaugh

RyanCavanaugh commented on Jun 14, 2023

@RyanCavanaugh
Member

Please post code, not screenshots of code.

This isn't part of a merged ECMAScript 2015, see https://github.com/tc39/proposal-resizablearraybuffer . This needs to go into ESnext first.

indrajitbnikam

indrajitbnikam commented on Jun 14, 2023

@indrajitbnikam
ContributorAuthor

Sorry about the screenshots. I'll update the description with code.

julien-c

julien-c commented on Mar 11, 2024

@julien-c

Note that https://github.com/tc39/proposal-resizablearraybuffer has landed in the spec now. So I think we could move ahead with this now?

guest271314

guest271314 commented on Jul 21, 2024

@guest271314

Reproducible in TypeScript playground

const buffer = new ArrayBuffer(0, { maxByteLength: 1024 ** 2 });

TypeScript error

Expected 1 arguments, but got 2.
guest271314

guest271314 commented on Jul 24, 2024

@guest271314

What's the status on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @julien-c@guest271314@RyanCavanaugh@indrajitbnikam

      Issue actions

        fix(dts): Update type of `ArrayBuffer` · Issue #54636 · microsoft/TypeScript