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

Add readonly typings for Set and Map #10921

Merged
merged 3 commits into from
Sep 15, 2016

Conversation

gmoothart
Copy link
Contributor

@gmoothart gmoothart commented Sep 14, 2016

Fixes #10919

Similar to ReadonlyArray, these typings remove the mutation methods from Set and Map so that they can only be initialized by the constructor.

Example

Similar to ReadonlyArray, these typings remove the mutation methods from Set and Map so that they can only be initialized by the constructor.
@msftclas
Copy link

Hi @gmoothart, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla.microsoft.com.

TTYL, MSBOT;

@mhegazy
Copy link
Contributor

mhegazy commented Sep 14, 2016

thanks @gmoothart. can you please sign the CLA?

Also corrected some parameter names.
thisArg?: any): void;
get(key: K): V|undefined;
has(key: K): boolean;
readonly size: number;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please match the formatting for the rest of the file, that is 4 spaces.

Copy link
Contributor

@mhegazy mhegazy left a comment

Choose a reason for hiding this comment

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

Some formatting changes, and we still need the CLA signed to be able to proceed.

forEach(
callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void,
thisArg?: any): void;
get(key: K): V|undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

and the spacing as well.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 15, 2016

I guess for the CLA i need to talk to @naomiblack.

Copy link
Contributor

@mhegazy mhegazy left a comment

Choose a reason for hiding this comment

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

👍

@gmoothart
Copy link
Contributor Author

Formatting fixed. I also updated some parameters names which were wrong, and fixed the example.

It would be nice to be able to have type inference for the generic parameters, but I don't think it's possible in this case?

Re: the CLA, there is a custom Google/Microsoft one that I did sign and yeah, Naomi should be able to help you.

@mhegazy mhegazy merged commit 9d8d2b6 into microsoft:master Sep 15, 2016
rictic added a commit to rictic/TypeScript-1 that referenced this pull request Apr 28, 2017
microsoft#10921 added readonly maps and sets, similar to ReadonlyArray.

This adds the iterator methods [Symbol.iterator], keys(), values(), and entries() to them as well.
@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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants