Skip to content

Inconsistent multiple export behavior for functions vs vars #10122

Closed
@evmar

Description

@evmar

typescript@2.1.0-dev.20160803

export type A = string;
function A() {}
export {A}

type B = string;
var B: void;
export {B};

The compiler accepts this module, and if you import it, you'll find that A is only exported as a type, not a value, but that B is both a type and value.

Note that two lines (1 and 3) both attempt to export A. If you make the B block try to do the same thing (add export before the first declaration of B) the compiler rejects the module with: "Individual declarations in merged declaration 'B' must be all exported or all local".

I suspect the right resolution of this is that it should reject the double export of A as well in this module.

Activity

DanielRosenwasser

DanielRosenwasser commented on Aug 4, 2016

@DanielRosenwasser
Member

Yup, and I agree that we should disallow the double export.

added a commit that references this issue on Aug 5, 2016
modified the milestones: Future, TypeScript 2.1 on Sep 29, 2016
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 TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @evmar@DanielRosenwasser@mhegazy

      Issue actions

        Inconsistent multiple export behavior for functions vs vars · Issue #10122 · microsoft/TypeScript