Skip to content

Invalid left hand side of assignment #2534

Closed

Description

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

Activity

  1. mhegazy commented on Mar 27, 2015

    @mhegazy
    Contributor

    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.

  2. vladima commented on Mar 28, 2015

    @vladima
    Contributor

    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;
  3. locked and limited conversation to collaborators on Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions