Skip to content

Type-only import that merges with namespace cannot be used in a type position. #36397

@rbuckton

Description

@rbuckton

TypeScript Version: 3.8.0-dev.20200123

Search Terms: type only import merged namesapce

Code

// file1.ts
export interface Foo { }
export namespace Foo {
  export const x = 1;
}

// file2.ts
import type { Foo } from "./file1";

declare function f(): Foo; // (1)

Expected behavior:

  1. No error

Actual behavior:

  1. Error: Cannot use namespace 'Foo' as a type.

Playground Link:
Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions