Skip to content

Can access UMD globals from modules (regression?) #26233

@mprobst

Description

@mprobst

TypeScript Version: Version 3.1.0-dev.20180804

Search Terms: UMD module import export as namespace

Code

// declaration.d.ts
export = angular;
export as namespace angular;

declare namespace angular {
  export interface Scope {}
}
export {};
// user.ts
export {}; // make me a module
let scope: angular.Scope;  // no import!

Expected behavior:

Should fail to compile, as user.ts is a module, but has no import for angular. The global should only be available in scripts, according to the docs:
https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#support-for-umd-module-definitions

Actual behavior:

Compiles without errors.

Playground Link: n/a, needs multiple files.

I believe this to be a regression, at least at some point TS worked as documented, giving an error here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions