Skip to content

Compiler should error when merging with a default exported declaration #3095

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Currently if you have the following file m1.ts

export default function Decl() {
    return 0;
}

export interface Decl {
    p1: number;
    p2: number;
}

export namespace Decl {
    export var x = 10;
    export var y = 20;

    interface I {
    }
}

trying to import m1.ts with a default binding will not give you all meanings of the exported entity:

import Entity from "m1"

Entity();

var x: Entity; // error
var y: Entity.I; // error

Entity.x; // error
Entity.y; // error

Discussed this with @JsonFreeman and @vladima, will try to elaborate more, but this issue should serve as a discussion point for suggestions, since there are certain interesting cases like non-exported uninstantiated namespaces.

Metadata

Metadata

Labels

Breaking ChangeWould introduce errors in existing codeBugA 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