Skip to content

"export type * as namespace" also exports value #36966

Closed
@whzx5byb

Description

@whzx5byb

TypeScript Version: 3.9.0-dev.20200222

Search Terms: export type * as namespace

Code

// provider.ts
export const foo = 42;
export interface Bar {};
// index1.ts
import type * as A from './provider';
export { A };
// index2.ts
export type * as A from './provider';
// 1.ts
import { A } from './index1';

const foo = A.foo;
type Bar = A.Bar;
// 2.ts
import { A } from './index2';

const foo = A.foo; // **expected an error, but succeed.**
type Bar = A.Bar;

Expected behavior:
index1.ts and index2.ts should have the same behaviour: export a namespace which only contain types, and the assignment to foo should result in an error.

Actual behavior:
In index2.ts the assignment succeed.

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions