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

IMPLEMENT GET SET similar c# "NOT DUPLICATE" #18984

Closed
srburton opened this issue Oct 6, 2017 · 9 comments
Closed

IMPLEMENT GET SET similar c# "NOT DUPLICATE" #18984

srburton opened this issue Oct 6, 2017 · 9 comments
Labels
Duplicate An existing issue was already created

Comments

@srburton
Copy link

srburton commented Oct 6, 2017

class Car{

public name {get; set; }
public marca {get; set;}

}

var c = new Car();

c.name = "fusca"; //SET

console.log(c.name); //GET

In case the compiler only needs to remove the
{get; set;} and set a common variable what do they think?

@DanielRosenwasser
Copy link
Member

Hey, thanks for filing, but this seems to be a duplicate of #10911

In the future using the issue tracker's search functionality can make it easier for us to triage issues. Thanks!

@DanielRosenwasser DanielRosenwasser added the Duplicate An existing issue was already created label Oct 6, 2017
@srburton
Copy link
Author

srburton commented Oct 6, 2017

That applies to decorators who yes is a useless implementation does not make sense even by how decorator the expression is simple

"public name {get; set;}"

example is decorators

"@get public name"

@srburton srburton changed the title IMPLEMENT GET SET similar c# IMPLEMENT GET SET similar c# "NOT DUPLICATE" Oct 6, 2017
@RyanCavanaugh
Copy link
Member

#7628

@srburton
Copy link
Author

srburton commented Oct 6, 2017

Where in the typescrypt compiler is the class counter in the typescrypt core so I can commit it and you see it's simple

#typescrypt.

class Car {
   
   public name {get; set;}

}

javascript example

var Car = function (...) {

     Car.prototype.name = null;

}

@srburton
Copy link
Author

srburton commented Oct 6, 2017

public name {get; set;} not is function !!!

default ->>
get : any
set: any

@srburton
Copy link
Author

srburton commented Oct 6, 2017

or

public name {get:string;set:any}

@kenlacoste843
Copy link

already discussed in #7628 mate..

One reason for this design tenet is that TS wants to stay compatible with future JS standards.

What if in the future JS chooses a different syntax for simplified properties? This happened in the past with modules and it was a little messy to recover from. Worse: what if JS introduces a new syntax that is plain incompatible with your proposed syntax?!

As kitsonk said, you probably should raise your voice at TC39 first so that the idea can trickle down from JS to TS.

the nearest that even got votes from the contributors is this #2763 where it considered its translation, compatibility and benefit towards .JS.

@srburton
Copy link
Author

srburton commented Oct 6, 2017

I'm just sorry

@mhegazy
Copy link
Contributor

mhegazy commented Oct 20, 2017

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@mhegazy mhegazy closed this as completed Oct 20, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 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

5 participants