facebook / facebook/flow

What is the best way to express an inner class?

Open
#4,204 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

I'm working with [openlayers](http://openlayers.org/) typing.
There is following inner class in code of _openlayers_.

``` javascript
// ol.Collection class
ol.Collection = function (/* ... parameters ... */) {
// ... class construction codes ...
}
// ... some methods

// ol.Collection.Error class
ol.Collection.Error = function (/* ... parameters ... */) {
// ... class construction codes ...
}
```

I try some typescript-like, C++-like, ... methods, (inner module, static inner class, ....) but no one works.
For example,

``` javascript
declare module 'ol' {
declare module 'Collection' {
declare class Error {
// ....
}
}
}
```

is rejected by flow.

Is there any clean choice for this case? If it is, could you give me some direction for typing this one?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.