Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Feat]: Technical: Translate connect to typescript (#1700)
dariaterekhovaae283586d0f3c6
diff --git a/babel.config.js b/babel.config.jsindex 858fd2227..233846061 100644--- a/babel.config.js+++ b/babel.config.js@@ -38,7 +38,8 @@ const PLUGINS = [root: ['./src'],alias: {test: './test'- }+ },+ extensions: ['.js', '.ts', '.tsx', '.json']}],[diff --git a/src/connect/keplergl-connect.js b/src/connect/keplergl-connect.tssimilarity index 98%rename from src/connect/keplergl-connect.jsrename to src/connect/keplergl-connect.tsindex 29325eb48..7bd7770af 100644--- a/src/connect/keplergl-connect.js+++ b/src/connect/keplergl-connect.ts@@ -27,8 +27,8 @@ const defaultMapDispatchToProps = () => (dispatch, _, __) => ({dispatch});export const connect = (mapStateToProps = defaultMapStateToProps,makeMapDispatchToProps = defaultMapDispatchToProps,- reduxMergeProps,- options+ reduxMergeProps?,+ options?) => BaseComponent => {const mapDispatchToProps = makeMapDispatchToProps();const reduxMapState = (state, props) => mapStateToProps(props.selector(state), props, state);diff --git a/src/connect/with-local-selector.d.ts b/src/connect/with-local-selector.d.tsdeleted file mode 100644index 22d31a7f0..000000000--- a/src/connect/with-local-selector.d.ts+++ /dev/null@@ -1,8 +0,0 @@-import {ComponentType} from 'react';-import KeplerGlContext from 'components/context';--interface ContextSelector {- (state: any, context: any): KeplerGlContext;-}--export default function withLocalSelector(ParentComponent: ComponentType): ComponentType;diff --git a/src/connect/with-local-selector.js b/src/connect/with-local-selector.tsxsimilarity index 92%rename from src/connect/with-local-selector.jsrename to src/connect/with-local-selector.tsxindex c24f3f91d..8ab5b2023 100644--- a/src/connect/with-local-selector.js+++ b/src/connect/with-local-selector.tsx@@ -18,7 +18,7 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import React, {Component} from 'react';+import React, {Component, ComponentType} from 'react';import {createSelector} from 'reselect';import KeplerGlContext from 'components/context';@@ -32,7 +32,7 @@ const mergeSelectors = (parentSelector, childSelector) => state =>// when a selector is passed to a container component,// it will be stored in the context and passed down to child components,// as well as prop to the given component-const withLocalSelector = ParentComponent => {+const withLocalSelector = (ParentComponent): ComponentType => {class WithConnectSelector extends Component {static contextType = KeplerGlContext;@@ -44,8 +44,7 @@ const withLocalSelector = ParentComponent => {this.selectorFromProps,(ctx, props) => mergeSelectors(ctx, props));- // TODO: This is tricky to type, revisit- /** @type import('./with-local-selector').ContextSelector */+contextSelector = createSelector(this.computedSelector, this.idFromProps, (selector, id) => ({selector,id