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-
31/**
42 * An *action* is a plain object that represents an intention to change the
53 * state. Actions are the only way to get data into the store. Any data,
@@ -224,6 +222,12 @@ export interface Unsubscribe {
224222 ( ) : void
225223}
226224
225+ declare global {
226+ interface SymbolConstructor {
227+ readonly observable : symbol ;
228+ }
229+ }
230+
227231/**
228232 * A minimal observable of state changes.
229233 * 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'
22
33import ActionTypes from './utils/actionTypes'
44import 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 {
1111import * as reducers from './helpers/reducers'
1212import { from } from 'rxjs'
1313import { map } from 'rxjs/operators'
14- import $$observable from 'symbol-observable'
14+ import $$observable from '../src/utils/ symbol-observable'
1515
1616describe ( 'createStore' , ( ) => {
1717 it ( 'exposes the public API' , ( ) => {
1818 const store = createStore ( combineReducers ( reducers ) )
19- const methods = Object . keys ( store )
2019
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+
2124 expect ( methods . length ) . toBe ( 4 )
2225 expect ( methods ) . toContain ( 'subscribe' )
2326 expect ( methods ) . toContain ( 'dispatch' )
Original file line number Diff line number Diff line change 99 Unsubscribe ,
1010 Observer ,
1111} from 'redux'
12- import 'symbol-observable'
12+ // @ts -ignore
13+ import $$observable from '../src/utils/symbol-observable'
1314
1415type BrandedString = string & { _brand : 'type' }
1516const brandedString = 'a string' as BrandedString
You can’t perform that action at this time.
0 commit comments