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

Feature Request: Declare variables as immutable #7796

Closed
michaelmesser opened this issue Apr 4, 2016 · 3 comments
Closed

Feature Request: Declare variables as immutable #7796

michaelmesser opened this issue Apr 4, 2016 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@michaelmesser
Copy link

Immutable would make a properties on an object immutable recursively.
Example:

immutable const a = ["1", "2", "3"]
a.push("4") // Error function mutates immutable variable

The would be useful with pure functions #7770

@RyanCavanaugh
Copy link
Member

This is close enough to what's in #6532 that I don't think we would do a new feature for it.

@mhegazy mhegazy added the Duplicate An existing issue was already created label Apr 5, 2016
@mhegazy mhegazy closed this as completed Apr 5, 2016
@michaelmesser
Copy link
Author

How do I declare a variable as readonly? The issue you linked to was taking about making a property readonly. There was a comment mentioning readonly variables but that was not implemented.

On Apr 5, 2016, at 6:20 PM, Mohamed Hegazy notifications@github.com wrote:

Closed #7796 #7796.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #7796 (comment)

@lastmjs
Copy link

lastmjs commented Jul 7, 2017

Yes, what about a variable that is just a variable, not part of an interface? Do we have any solution for checking the immutability of one-off variables?

@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
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants