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

TypedArrays missing signature #4206

Closed
sebdoucet opened this issue Aug 7, 2015 · 4 comments
Closed

TypedArrays missing signature #4206

sebdoucet opened this issue Aug 7, 2015 · 4 comments
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue

Comments

@sebdoucet
Copy link

Hi,

Is it wanted this signature is not availlable in default lib.ts on all typed array :

set(array: Array<number>, offset?: number): void;

I don't look to specs, but it's working everywhere on typed arrays and it's not the case for other methods like fill, reverse, foreach, etc.

It's not a big deal to had this on a custom missing signature file, but it doen t make sence for me having stuff that doesn t work and not stuff that already work.

Regards.

@danquirk
Copy link
Member

danquirk commented Aug 7, 2015

Signatures here do seem wrong.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set

typedarr.set(array [,offset])
typedarr.set(typedarray [,offset])

whereas our definition for Uint8Array has these two signatures:

set(index: number, value: number): void;
set(array: Uint8Array, offset?: number): void;

@danquirk danquirk added Bug A bug in TypeScript Help Wanted You can do this Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Aug 7, 2015
@mhegazy mhegazy added this to the Community milestone Aug 11, 2015
@Eyas
Copy link
Contributor

Eyas commented Sep 13, 2015

What is the correct resolution here? The current core.d.ts has:

set(index: number, value: number): void;
set(array: ArrayLike<number>, offset?: number): void;

The second variable takes care of both MDN cases:

typedarr.set(array [,offset])
typedarr.set(typedarray [,offset])

Judging by the MDN link, we should simply remove the first overload. MSDN, on the other hand, claims that this overload is valid:

uint8Array.set(index, value);
uint8Array.set(array, offset);

If MSDN is right, then there is no valid work item for this issue; it should be closed. If MDN is right, then we should change this ticket to refer to removing the first overload, and resolve it accordingly.

@DanielRosenwasser
Copy link
Member

Sounds like this is fixed; @zhengbli can you confirm?

@zhengbli
Copy link
Contributor

This is fixed by 20902b0, which added another signature to all the typed arrays:
set(array: ArrayLike<number>, offset?: number): void;

@mhegazy mhegazy closed this as completed Sep 14, 2015
@mhegazy mhegazy modified the milestones: TypeScript 1.6, Community Sep 14, 2015
@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Help Wanted You can do this labels Sep 14, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

6 participants