Skip to content

Invalid left hand side of assignment #2534

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

Closed
basarat opened this issue Mar 27, 2015 · 2 comments · Fixed by #2569
Closed

Invalid left hand side of assignment #2534

basarat opened this issue Mar 27, 2015 · 2 comments · Fixed by #2569
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@basarat
Copy link
Contributor

basarat commented Mar 27, 2015

Broken in the last six days. The following was and is okay:

var foo = function(){}
foo = function(){}

However as soon as you split the two into external modules
i.e. mod1.ts

export var foo = function(){}

mod2.ts

import mod1 = require('./mod1'); 
mod1.foo = function(){}; // Error : Invalid left hand side of assignment
@mhegazy mhegazy added the Bug A bug in TypeScript label Mar 27, 2015
@mhegazy mhegazy added this to the TypeScript 1.5 milestone Mar 27, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Mar 27, 2015

that is caused by #2476. foo in import {foo} from "mod" should be immutable, but i do not think ns.foo in import * as ns from "mod" should be.

@vladima
Copy link
Contributor

vladima commented Mar 28, 2015

I've checked ES6 spec - all bindings that are created for imported names are immutable so all cases below should be illegal:

import * as ns, {foo} from 'foo'
import d from 'foo'

ns.a = 1;
foo = 1;
d = 1;

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Apr 1, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants