Closed
Description
TypeScript Version: 3.5.0-dev.20190419
Search Terms: import export conflict priority
Code
/// foo.ts
export interface Foo { a: number; }
/// test.ts
import { Foo } from './foo'
export interface Foo { b: number; }
let foo: Foo = { a: 2 }
Expected behavior: Declaration conflict on test.ts
(imported Foo vs exported Foo).
Actual behavior: No error. Instead, (see last line) Foo
refers to the imported Foo, and the exported Foo becomes unaccessible. Is this expected?
If export interface
is changed to export class
, then a declaration conflict appears.
If export
is removed in initial case, a declaration conflict also appears.
Playground Link: I don't know how to reproduce this with one file.
Related Issues: I searched issues, stackoverflow and docs (declaration merging, imports and exports, namespaces) but couldn't find any references to this behaviour.