Skip to content

Can't augment UMD namespace #12106

Closed

Description

This is related to #12030.

TypeScript Version: nightly (@2.1.0-dev.20161108)

Code

// @Filename: /types/lib/index.d.ts
declare var lib: lib.Static;
export as namespace lib;
export = lib;

declare namespace lib {
    interface Static {
        stat(): void;
    }
}

// @Filename: /types/lib-extender/index.d.ts
declare namespace lib {
    export function fn(): void;
}

// @Filename: /src/a.ts
let bar: lib.Static;
lib.fn();

// @Filename: /tsconfig.json
{
    "compilerOptions": {
        "baseUrl": ".",
        "paths": {
            "*": ["types/*"]
        }
    }
}

Expected behavior:

No errors.

Actual behavior:

error TS2694: Namespace '"/types/lib/index".lib' has no exported member 'Static'.

Attempting to augment a UMD namespace appears to just overwrite it.

Activity

  1. mattmccutchen commented on Aug 12, 2018

    @mattmccutchen
    Contributor

    If I may piggyback on this issue report, attempting to augment the external module that underlies the UMD global doesn't work either. Same example as above except types/lib-extender/index.d.ts contains:

    declare module "lib" {
        export function fn(): void;
    }
  2. ghost removed this from the TypeScript 3.1 milestone on Sep 6, 2018
  3. ghost added this to the TypeScript 3.2 milestone on Sep 6, 2018
  4. ghost added
    FixedA PR has been merged for this issue
    on Sep 21, 2018
  5. ghost closed this as completedin #27281on Oct 30, 2018
  6. locked as resolved and limited conversation to collaborators on Oct 21, 2025
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