File tree Expand file tree Collapse file tree 5 files changed +17
-6
lines changed Expand file tree Collapse file tree 5 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1
- /// <reference types="symbol-observable" />
2
-
3
1
/**
4
2
* An *action* is a plain object that represents an intention to change the
5
3
* state. Actions are the only way to get data into the store. Any data,
@@ -224,6 +222,12 @@ export interface Unsubscribe {
224
222
( ) : void
225
223
}
226
224
225
+ declare global {
226
+ interface SymbolConstructor {
227
+ readonly observable : symbol ;
228
+ }
229
+ }
230
+
227
231
/**
228
232
* A minimal observable of state changes.
229
233
* For more information, see the observable proposal:
Original file line number Diff line number Diff line change 1
- import $$observable from 'symbol-observable'
1
+ import $$observable from './utils/ symbol-observable'
2
2
3
3
import ActionTypes from './utils/actionTypes'
4
4
import isPlainObject from './utils/isPlainObject'
Original file line number Diff line number Diff line change
1
+ // Inlined version of the `symbol-observable` polyfill
2
+ export default ( ( ) =>
3
+ ( typeof Symbol === 'function' && Symbol . observable ) || '@@observable' ) ( )
Original file line number Diff line number Diff line change @@ -11,13 +11,16 @@ import {
11
11
import * as reducers from './helpers/reducers'
12
12
import { from } from 'rxjs'
13
13
import { map } from 'rxjs/operators'
14
- import $$observable from 'symbol-observable'
14
+ import $$observable from '../src/utils/ symbol-observable'
15
15
16
16
describe ( 'createStore' , ( ) => {
17
17
it ( 'exposes the public API' , ( ) => {
18
18
const store = createStore ( combineReducers ( reducers ) )
19
- const methods = Object . keys ( store )
20
19
20
+ // Since switching to internal Symbol.observable impl, it will show up as a key in node env
21
+ // So we filter it out
22
+ const methods = Object . keys ( store ) . filter ( key => key !== $$observable )
23
+
21
24
expect ( methods . length ) . toBe ( 4 )
22
25
expect ( methods ) . toContain ( 'subscribe' )
23
26
expect ( methods ) . toContain ( 'dispatch' )
Original file line number Diff line number Diff line change 9
9
Unsubscribe ,
10
10
Observer ,
11
11
} from 'redux'
12
- import 'symbol-observable'
12
+ // @ts -ignore
13
+ import $$observable from '../src/utils/symbol-observable'
13
14
14
15
type BrandedString = string & { _brand : 'type' }
15
16
const brandedString = 'a string' as BrandedString
You can’t perform that action at this time.
0 commit comments