Skip to content

Remove the clause about changes on aliased variables #3423

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

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

fluiderson
Copy link

Consider an example:

namespace Shapes {
  export namespace Polygons {
    export var S = 5;
  }
}

import polygons = Shapes.Polygons;

console.log(polygons.S); // 5

polygons.S = 123;

console.log(polygons.S); // 123
console.log(Shapes.Polygons.S); // 123

According to

Importantly, for values, import is a distinct reference from the original symbol, so changes to an aliased var will not be reflected in the original variable.

the S shouldn't be changed in this example, right? But it changes.

I'm not sure what "distinct reference" means exactly here. Maybe I just misinterpret this clause. Or maybe something changed in TS and it's not true anymore. Anyhow, its meaning isn't very clear.

It's also impossible to reassign an alias. Was it possible in the far past? If it is, then maybe this clause alludes to such a scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant