Skip to content

Conversation

vladima
Copy link
Contributor

@vladima vladima commented Apr 15, 2016

fixes #8102

@@ -15596,6 +15596,9 @@ namespace ts {
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.TypeAliasDeclaration:
Copy link
Member

@DanielRosenwasser DanielRosenwasser Apr 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a case for import = declarations above that reports this error in global module augmentations.

@vladima
Copy link
Contributor Author

vladima commented Apr 15, 2016

0f323ea also fixes asymmetry that we currently have: in ambient namespaces without explicitly exported declarations all entities were considered exported except imports. This is technically a breaking change in following scenario however I have no idea what this code might do in the first place

declare namespace A.B {
    let x: number;
}

declare namespace M {
    import X = A.B.x;
    let X: string;
}

M.X // refers to let X: string

It is only an issue in ambient case - non-ambient version correctly yields error about colliding declarations.

@mhegazy
Copy link
Contributor

mhegazy commented Apr 15, 2016

Can you run definitely typed tests on this change and see if there are any new errors? i have definitely seen this pattern in the past.

@vladima
Copy link
Contributor Author

vladima commented Apr 15, 2016

revering back since it breaks the following case:

declare module "A" {
    import X = A.B.C
    let y = X.M1;
}
declare module "A" {
    import X = A.B.C
    let z = X.M2;
}

@vladima
Copy link
Contributor Author

vladima commented Apr 15, 2016

@mhegazy any other comments?

@mhegazy
Copy link
Contributor

mhegazy commented Apr 15, 2016

👍

@vladima vladima merged commit 79a3e77 into master Apr 15, 2016
@vladima vladima deleted the newEntitiesInGlobalAugmentations branch April 15, 2016 22:09
basarat added a commit to alm-tools/alm that referenced this pull request Apr 16, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow declare global to declare new names
4 participants