Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TS type declarations for BasemapName and CartoSlice #248

Merged
merged 5 commits into from
Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Refactor useViewportFeatures [#238](https://github.com/CartoDB/carto-react/pull/238)
- Add clear button for TimeSeriesWidget widget and enable the speed button even though the animation has not started [#239](https://github.com/CartoDB/carto-react/pull/239)
- Improve timeseries animation performance [#243](https://github.com/CartoDB/carto-react/pull/243)
- Fix TS type declarations for BasemapName and CartoSlice [#248](https://github.com/CartoDB/carto-react/pull/248)

## 1.1.3 (2021-12-04)

Expand Down
7 changes: 4 additions & 3 deletions packages/react-redux/src/slices/cartoSlice.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Credentials } from '@carto/react-api/';
import { SourceProps } from '@carto/react-api/types';
import { CartoBasemapsNames, GMapsBasemapsNames } from '@carto/react-basemaps/';
import { InitialCartoState, Reducer, ViewState } from '../types';
import { InitialCartoState, CartoState, ViewState } from '../types';
import { AnyAction, Reducer } from 'redux';

type Source = SourceProps & { id: string } & { filters?: any};

Expand All @@ -11,7 +12,7 @@ type Layer = {
layerAttributes?: object;
};

type BasemapName = CartoBasemapsNames & GMapsBasemapsNames;
type BasemapName = CartoBasemapsNames | GMapsBasemapsNames;

type FilterBasic = {
type: '';
Expand Down Expand Up @@ -57,7 +58,7 @@ declare enum CartoActions {
SET_CREDENTIALS = 'carto/setCredentials'
}

export function createCartoSlice(initialState: InitialCartoState): Reducer;
export function createCartoSlice(initialState: InitialCartoState): Reducer<CartoState, AnyAction>;

export function addSource(
source: Source
Expand Down
5 changes: 3 additions & 2 deletions packages/react-redux/src/slices/oauthSlice.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { OauthApp } from '@carto/react-auth/';
import { InitialOauthState, Reducer } from '../types';
import { InitialOauthState, OauthState } from '../types';
import { AnyAction, Reducer } from 'redux';

type OauthParams = {
accessToken: string,
Expand All @@ -18,7 +19,7 @@ declare enum OauthActions {
LOGOUT = 'oauth/logout'
}

export function createOauthCartoSlice(initialState: InitialOauthState): Reducer;
export function createOauthCartoSlice(initialState: InitialOauthState): Reducer<OauthState, AnyAction>;

export function setOAuthApp(arg: OauthApp): {
type: OauthActions.SET_OAUTH_APP,
Expand Down
6 changes: 0 additions & 6 deletions packages/react-redux/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Credentials } from '@carto/react-api';
import { OauthApp } from '@carto/react-auth';
import { CartoBasemapsNames } from '@carto/react-basemaps';
import { Viewport } from '@carto/react-core';
import { AnyAction } from 'redux';

export type ViewState = {
latitude?: number,
Expand Down Expand Up @@ -54,8 +53,3 @@ export type OauthState = {
token: string,
userInfo: string
} & InitialOauthState;

export type Reducer = {
state: CartoState | OauthState,
action: AnyAction
}