Skip to content

Commit

Permalink
Use export type for re-exporting type definitions
Browse files Browse the repository at this point in the history
Fixes compilation under typescript with `isolatedModules: true`

See https://devblogs.microsoft.com/typescript/announcing-typescript-3-8/#type-only-imports-exports
  • Loading branch information
sundbry committed Mar 15, 2022
1 parent 31bfd08 commit 22843a9
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 21 deletions.
2 changes: 1 addition & 1 deletion spec/ajax/index-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ describe('index', () => {
});

it('should export Ajax data classes', () => {
expect(index.AjaxResponse).to.exist;
expect(index.AjaxError).to.exist;
expect(index.AjaxTimeoutError).to.exist;
// Interfaces can be checked by creating a variable of that type
let ajaxRequest: index.AjaxRequest;
let ajaxResponse: index.AjaxResponse;
});
});
2 changes: 1 addition & 1 deletion src/ajax/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { ajax } from '../internal/ajax/ajax';
export { AjaxError, AjaxTimeoutError } from '../internal/ajax/errors';
export { AjaxResponse } from '../internal/ajax/AjaxResponse';
export { AjaxRequest, AjaxConfig, AjaxDirection } from '../internal/ajax/types';
export type { AjaxRequest, AjaxConfig, AjaxDirection } from '../internal/ajax/types';
28 changes: 18 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
/* Observable */
export { Observable } from './internal/Observable';
export { ConnectableObservable } from './internal/observable/ConnectableObservable';
export { GroupedObservable } from './internal/operators/groupBy';
export { Operator } from './internal/Operator';
export type { GroupedObservable } from './internal/operators/groupBy';
export type { Operator } from './internal/Operator';
export { observable } from './internal/symbol/observable';
export { animationFrames } from './internal/observable/dom/animationFrames';

Expand Down Expand Up @@ -97,7 +97,8 @@ export { NEVER } from './internal/observable/never';
export * from './internal/types';

/* Config */
export { config, GlobalConfig } from './internal/config';
export { config } from './internal/config';
export type { GlobalConfig } from './internal/config';

/* Operators */
export { audit } from './internal/operators/audit';
Expand All @@ -115,7 +116,8 @@ export { concatAll } from './internal/operators/concatAll';
export { concatMap } from './internal/operators/concatMap';
export { concatMapTo } from './internal/operators/concatMapTo';
export { concatWith } from './internal/operators/concatWith';
export { connect, ConnectConfig } from './internal/operators/connect';
export { connect } from './internal/operators/connect';
export type { ConnectConfig } from './internal/operators/connect';
export { count } from './internal/operators/count';
export { debounce } from './internal/operators/debounce';
export { debounceTime } from './internal/operators/debounceTime';
Expand All @@ -138,7 +140,8 @@ export { finalize } from './internal/operators/finalize';
export { find } from './internal/operators/find';
export { findIndex } from './internal/operators/findIndex';
export { first } from './internal/operators/first';
export { groupBy, BasicGroupByOptions, GroupByOptionsWithElement } from './internal/operators/groupBy';
export { groupBy } from './internal/operators/groupBy';
export type { BasicGroupByOptions, GroupByOptionsWithElement } from './internal/operators/groupBy';
export { ignoreElements } from './internal/operators/ignoreElements';
export { isEmpty } from './internal/operators/isEmpty';
export { last } from './internal/operators/last';
Expand All @@ -165,15 +168,18 @@ export { raceWith } from './internal/operators/raceWith';
export { reduce } from './internal/operators/reduce';
export { repeat } from './internal/operators/repeat';
export { repeatWhen } from './internal/operators/repeatWhen';
export { retry, RetryConfig } from './internal/operators/retry';
export { retry } from './internal/operators/retry';
export type { RetryConfig } from './internal/operators/retry';
export { retryWhen } from './internal/operators/retryWhen';
export { refCount } from './internal/operators/refCount';
export { sample } from './internal/operators/sample';
export { sampleTime } from './internal/operators/sampleTime';
export { scan } from './internal/operators/scan';
export { sequenceEqual } from './internal/operators/sequenceEqual';
export { share, ShareConfig } from './internal/operators/share';
export { shareReplay, ShareReplayConfig } from './internal/operators/shareReplay';
export { share } from './internal/operators/share';
export type { ShareConfig } from './internal/operators/share';
export { shareReplay } from './internal/operators/shareReplay';
export type { ShareReplayConfig } from './internal/operators/shareReplay';
export { single } from './internal/operators/single';
export { skip } from './internal/operators/skip';
export { skipLast } from './internal/operators/skipLast';
Expand All @@ -190,11 +196,13 @@ export { takeLast } from './internal/operators/takeLast';
export { takeUntil } from './internal/operators/takeUntil';
export { takeWhile } from './internal/operators/takeWhile';
export { tap } from './internal/operators/tap';
export { throttle, ThrottleConfig } from './internal/operators/throttle';
export { throttle } from './internal/operators/throttle';
export type { ThrottleConfig } from './internal/operators/throttle';
export { throttleTime } from './internal/operators/throttleTime';
export { throwIfEmpty } from './internal/operators/throwIfEmpty';
export { timeInterval } from './internal/operators/timeInterval';
export { timeout, TimeoutConfig, TimeoutInfo } from './internal/operators/timeout';
export { timeout } from './internal/operators/timeout';
export type { TimeoutConfig, TimeoutInfo } from './internal/operators/timeout';
export { timeoutWith } from './internal/operators/timeoutWith';
export { timestamp } from './internal/operators/timestamp';
export { toArray } from './internal/operators/toArray';
Expand Down
21 changes: 14 additions & 7 deletions src/operators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export { concatAll } from '../internal/operators/concatAll';
export { concatMap } from '../internal/operators/concatMap';
export { concatMapTo } from '../internal/operators/concatMapTo';
export { concatWith } from '../internal/operators/concatWith';
export { connect, ConnectConfig } from '../internal/operators/connect';
export { connect } from '../internal/operators/connect';
export type { ConnectConfig } from '../internal/operators/connect';
export { count } from '../internal/operators/count';
export { debounce } from '../internal/operators/debounce';
export { debounceTime } from '../internal/operators/debounceTime';
Expand All @@ -39,7 +40,8 @@ export { finalize } from '../internal/operators/finalize';
export { find } from '../internal/operators/find';
export { findIndex } from '../internal/operators/findIndex';
export { first } from '../internal/operators/first';
export { groupBy, BasicGroupByOptions, GroupByOptionsWithElement } from '../internal/operators/groupBy';
export { groupBy } from '../internal/operators/groupBy';
export type { BasicGroupByOptions, GroupByOptionsWithElement } from '../internal/operators/groupBy';
export { ignoreElements } from '../internal/operators/ignoreElements';
export { isEmpty } from '../internal/operators/isEmpty';
export { last } from '../internal/operators/last';
Expand Down Expand Up @@ -70,15 +72,18 @@ export { raceWith } from '../internal/operators/raceWith';
export { reduce } from '../internal/operators/reduce';
export { repeat } from '../internal/operators/repeat';
export { repeatWhen } from '../internal/operators/repeatWhen';
export { retry, RetryConfig } from '../internal/operators/retry';
export { retry } from '../internal/operators/retry';
export type { RetryConfig } from '../internal/operators/retry';
export { retryWhen } from '../internal/operators/retryWhen';
export { refCount } from '../internal/operators/refCount';
export { sample } from '../internal/operators/sample';
export { sampleTime } from '../internal/operators/sampleTime';
export { scan } from '../internal/operators/scan';
export { sequenceEqual } from '../internal/operators/sequenceEqual';
export { share, ShareConfig } from '../internal/operators/share';
export { shareReplay, ShareReplayConfig } from '../internal/operators/shareReplay';
export { share } from '../internal/operators/share';
export type { ShareConfig } from '../internal/operators/share';
export { shareReplay } from '../internal/operators/shareReplay';
export type { ShareReplayConfig } from '../internal/operators/shareReplay';
export { single } from '../internal/operators/single';
export { skip } from '../internal/operators/skip';
export { skipLast } from '../internal/operators/skipLast';
Expand All @@ -95,11 +100,13 @@ export { takeLast } from '../internal/operators/takeLast';
export { takeUntil } from '../internal/operators/takeUntil';
export { takeWhile } from '../internal/operators/takeWhile';
export { tap } from '../internal/operators/tap';
export { throttle, ThrottleConfig } from '../internal/operators/throttle';
export { throttle } from '../internal/operators/throttle';
export type { ThrottleConfig } from '../internal/operators/throttle';
export { throttleTime } from '../internal/operators/throttleTime';
export { throwIfEmpty } from '../internal/operators/throwIfEmpty';
export { timeInterval } from '../internal/operators/timeInterval';
export { timeout, TimeoutConfig, TimeoutInfo } from '../internal/operators/timeout';
export { timeout } from '../internal/operators/timeout';
export type { TimeoutConfig, TimeoutInfo } from '../internal/operators/timeout';
export { timeoutWith } from '../internal/operators/timeoutWith';
export { timestamp } from '../internal/operators/timestamp';
export { toArray } from '../internal/operators/toArray';
Expand Down
3 changes: 2 additions & 1 deletion src/testing/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { TestScheduler, RunHelpers } from '../internal/testing/TestScheduler';
export { TestScheduler } from '../internal/testing/TestScheduler';
export type { RunHelpers } from '../internal/testing/TestScheduler';
3 changes: 2 additions & 1 deletion src/webSocket/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { webSocket as webSocket } from '../internal/observable/dom/webSocket';
export { WebSocketSubject, WebSocketSubjectConfig } from '../internal/observable/dom/WebSocketSubject';
export { WebSocketSubject } from '../internal/observable/dom/WebSocketSubject';
export type { WebSocketSubjectConfig } from '../internal/observable/dom/WebSocketSubject';

0 comments on commit 22843a9

Please sign in to comment.