Skip to content

Add readonly typings for Set and Map#10921

Merged
mhegazy merged 3 commits into
microsoft:masterfrom
gmoothart:readonly-collections
Sep 15, 2016
Merged

Add readonly typings for Set and Map#10921
mhegazy merged 3 commits into
microsoft:masterfrom
gmoothart:readonly-collections

Conversation

@gmoothart
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
Contributor

mhegazy commented Sep 14, 2016

thanks @gmoothart. can you please sign the CLA?

Also corrected some parameter names.
Comment thread src/lib/es2015.collection.d.ts Outdated
thisArg?: any): void;
get(key: K): V|undefined;
has(key: K): boolean;
readonly size: number;
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread src/lib/es2015.collection.d.ts Outdated
forEach(
callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void,
thisArg?: any): void;
get(key: K): V|undefined;
Copy link
Copy Markdown
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
Copy Markdown
Contributor

mhegazy commented Sep 15, 2016

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

Copy link
Copy Markdown
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
Copy Markdown
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.

3 participants