Skip to content

Commit efdaf3e

Browse files
authored
fix (datafile manager): Rename top-level exports to avoid conflict with interface name (#291)
Summary: The interface DatafileManager, defined in src/datafileManager.ts, is exported from src/index.node.ts and src/index.browser.ts. However, in each of these top-level entry points, another export statement appears below, which exports something else (the actual implementation of the datafile manager), using the same name. To avoid the name conflict, we rename the exports of the datafile manager implementations from DatafileManager to HttpPollingDatafileManager. Test plan: Updated unit tests
1 parent d0ac882 commit efdaf3e

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

packages/datafile-manager/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
## [Unreleased]
88
Changes that have landed but are not yet released.
99

10+
### Changed
11+
- Changed name of top-level exports in index.node.ts and index.browser.ts from DatafileManager to HttpPollingDatafileManager, to avoid name conflict with DatafileManager interface
12+
1013
## [0.3.0] - May 13, 2019
1114

1215
### New Features

packages/datafile-manager/__test__/httpPollingDatafileManager.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import HTTPPollingDatafileManager from '../src/httpPollingDatafileManager'
17+
import HttpPollingDatafileManager from '../src/httpPollingDatafileManager'
1818
import { Headers, AbortableRequest, Response } from '../src/http'
1919
import { DatafileManagerConfig } from '../src/datafileManager';
2020
import { advanceTimersByTime, getTimerCount } from './testUtils'
@@ -34,7 +34,7 @@ import BackoffController from '../src/backoffController'
3434

3535
// Test implementation:
3636
// - Does not make any real requests: just resolves with queued responses (tests push onto queuedResponses)
37-
class TestDatafileManager extends HTTPPollingDatafileManager {
37+
class TestDatafileManager extends HttpPollingDatafileManager {
3838
queuedResponses: (Response | Error)[] = []
3939

4040
responsePromises: Promise<Response>[] = []

packages/datafile-manager/src/httpPollingDatafileManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function isSuccessStatusCode(statusCode: number): boolean {
3434
return statusCode >= 200 && statusCode < 400
3535
}
3636

37-
export default abstract class HTTPPollingDatafileManager implements DatafileManager {
37+
export default abstract class HttpPollingDatafileManager implements DatafileManager {
3838
// Make an HTTP get request to the given URL with the given headers
3939
// Return an AbortableRequest, which has a promise for a Response.
4040
// If we can't get a response, the promise is rejected.
@@ -208,7 +208,7 @@ export default abstract class HTTPPollingDatafileManager implements DatafileMana
208208
}
209209
}
210210

211-
private onRequestComplete(this: HTTPPollingDatafileManager): void {
211+
private onRequestComplete(this: HttpPollingDatafileManager): void {
212212
if (!this.isStarted) {
213213
return
214214
}

packages/datafile-manager/src/index.browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
*/
1616

1717
export * from './datafileManager'
18-
export { default as DatafileManager } from './browserDatafileManager'
18+
export { default as HttpPollingDatafileManager } from './browserDatafileManager'
1919
export { default as StaticDatafileManager } from './staticDatafileManager';

packages/datafile-manager/src/index.node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
*/
1616

1717
export * from './datafileManager'
18-
export { default as DatafileManager } from './nodeDatafileManager'
18+
export { default as HttpPollingDatafileManager } from './nodeDatafileManager'
1919
export { default as StaticDatafileManager } from './staticDatafileManager';

0 commit comments

Comments
 (0)