2
2
// Definitions by: Jedrzej Lewandowski <https://github.com/TheFullResolution>
3
3
// TypeScript Version: 2.7.2
4
4
5
- import * as React from 'react'
5
+ import React from 'react'
6
6
import {
7
7
ButtonBack ,
8
8
ButtonFirst ,
@@ -26,7 +26,7 @@ import {
26
26
ButtonLastProps ,
27
27
ButtonFirstProps ,
28
28
ButtonPlayProps
29
- } from './carouselElements.d '
29
+ } from './carouselElements'
30
30
31
31
interface CarouselState {
32
32
readonly currentSlide : number
@@ -97,7 +97,7 @@ interface CarouselProviderProps {
97
97
readonly isIntrinsicHeight ?: CarouselState [ 'isIntrinsicHeight' ]
98
98
}
99
99
100
- type CarouselProviderInterface = React . ComponentClass < CarouselProviderProps >
100
+ type CarouselProviderInterface = React . ComponentType < CarouselProviderProps >
101
101
/**
102
102
* CarouselProvider allows the other carousel components to communicate with each other.
103
103
*
@@ -115,31 +115,25 @@ type CarouselProviderInterface = React.ComponentClass<CarouselProviderProps>
115
115
declare const CarouselProvider : CarouselProviderInterface
116
116
117
117
export interface CarouselInjectedProps {
118
- readonly carouselStore : CarouselStoreInterface
118
+ readonly carouselStore : Pick <
119
+ CarouselStoreInterface ,
120
+ | "getStoreState"
121
+ | "masterSpinnerError"
122
+ | "masterSpinnerSuccess"
123
+ | "setStoreState"
124
+ | "subscribeMasterSpinner"
125
+ | "unsubscribeAllMasterSpinner"
126
+ | "unsubscribeMasterSpinner"
127
+ > ;
119
128
}
120
129
121
- // Diff / Omit taken from https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-311923766
122
- type Diff < T extends string , U extends string > = ( { [ P in T ] : P } &
123
- { [ P in U ] : never } & { readonly [ x : string ] : never } ) [ T ]
124
- type Omit < T , K extends keyof T > = Pick < T , Diff < Extract < keyof T , string > , Extract < K , string > > >
125
-
126
130
type MapStateToProps < TStateProps > = ( state : CarouselState ) => TStateProps
127
131
128
132
interface WithStoreInterface {
129
- < CustomProps extends CarouselInjectedProps > (
130
- component : React . ComponentClass < CustomProps >
131
- ) : React . ComponentClass < Omit < CustomProps , keyof CarouselInjectedProps > > & {
132
- readonly WrappedComponent : React . ComponentClass < CustomProps >
133
- }
134
-
135
- < CustomProps extends CarouselInjectedProps , CustomStateProps > (
136
- component : React . ComponentClass < CustomProps & CustomStateProps > ,
137
- state : MapStateToProps < CustomStateProps >
138
- ) : React . ComponentClass < Omit < CustomProps , keyof CarouselInjectedProps > > & {
139
- readonly WrappedComponent : React . ComponentClass <
140
- CustomProps & CustomStateProps
141
- >
142
- }
133
+ < CustomProps , CustomStateProps = { } > (
134
+ component : React . ComponentType < CustomProps & CustomStateProps & CarouselInjectedProps > ,
135
+ mapStateToProps ?: MapStateToProps < CustomStateProps >
136
+ ) : React . ComponentType < CustomProps >
143
137
}
144
138
/**
145
139
* Use this HOC to pass CarouselProvider state properties as props to a component.
0 commit comments