Non-exported, module-scoped values in a library definition are still importable
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Let's say I have the following library definition:
```
declare module 'mod' {
declare class Foo {};
}
```
According to [the Flow docs](https://flow.org/en/docs/libdefs/creation/#toc-declaring-an-es-module), I shouldn't be able to import Foo in a source file:
> Note that you can also declare other things inside the body of the `declare module`, and those things will be scoped to the body of the `declare module` – **but they will not be exported from the module**.
Therefore I'd expect that the following source file would throw a Flow error:
```js
// @flow
import type { Foo } from 'mod';
let x: Foo;
```
If this isn't buggy behavior and I'm simply misinterpreting the docs, then what's the difference between what I've written in the libdef above and, say, `declare export class Foo {};` instead?
Contributor guide
Assessment
This issue has not been assessed yet.