Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lib.d.ts): fixed buffer parameter type of DataView #53130

Merged
merged 3 commits into from
Apr 11, 2023

Conversation

lpizzinidev
Copy link
Contributor

@lpizzinidev lpizzinidev commented Mar 7, 2023

The DataView constructor parameter type is incorrectly broad by accepting ArrayBufferLike because TypedArray's such as Uint8Array match the ArrayBufferLike type but are not valid parameters.

  • There is an associated issue in the Backlog milestone (required)
  • Code is up-to-date with the main branch
  • You've successfully run hereby runtests locally
  • There are new or updated unit tests validating the change

Fixes #52815

@typescript-bot
Copy link
Collaborator

It looks like you've sent a pull request to update our 'lib' files. These files aren't meant to be edited by hand, as they consist of last-known good states of the compiler and are generated from 'src/lib' or possibly our lib generator. Unless this is necessary, consider closing the pull request and sending a separate PR to update 'src/lib' or https://github.com/microsoft/TypeScript-DOM-lib-generator

@typescript-bot typescript-bot added lib update PR modifies files in the `lib` folder For Backlog Bug PRs that fix a backlog bug labels Mar 7, 2023
@lpizzinidev
Copy link
Contributor Author

@lpizzinidev please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'll merge this after it's merged up-to-date with main.

@sandersn sandersn self-assigned this Mar 17, 2023
@sandersn sandersn merged commit af5e8e2 into microsoft:main Apr 11, 2023
@sandersn
Copy link
Member

Addresses #52956

@jakebailey
Copy link
Member

This broke pvutils on DT:

Error in pvutils
Error: /home/vsts/work/1/s/types/pvutils/pvutils-tests.ts:40:42
ERROR: 40:42  expect  [email protected] compile error: 
Argument of type 'Uint8Array' is not assignable to parameter of type 'ArrayBuffer & { BYTES_PER_ELEMENT?: undefined; }'.
  Type 'Uint8Array' is not assignable to type '{ BYTES_PER_ELEMENT?: undefined; }'.
    Types of property 'BYTES_PER_ELEMENT' are incompatible.
      Type 'number' is not assignable to type 'undefined'.

This looks like exactly the case mentioned in the description, though, so I guess this test should just be changed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug lib update PR modifies files in the `lib` folder
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Constructor for DataView is too broad
4 participants