diff --git a/src/BearCarousel.tsx b/src/BearCarousel.tsx index f04652f..6fd6902 100644 --- a/src/BearCarousel.tsx +++ b/src/BearCarousel.tsx @@ -33,7 +33,7 @@ interface IState { class BearCarousel extends React.Component { - static defaultProps = { + static defaultProps: IBearCarouselProps = { data: undefined, slidesPerView: 1, slidesPerGroup: 1, // 不可為小數 @@ -50,7 +50,6 @@ class BearCarousel extends React.Component { moveTime: 500, autoPlayTime: 5000, initStartPlayTime: 1500, - defaultActivePage: 1, isSlideItemMemo: false, }; _isEnableGpuRender = checkIsDesktop(); diff --git a/src/manager/Configurator/types.ts b/src/manager/Configurator/types.ts index e70304a..078dee1 100644 --- a/src/manager/Configurator/types.ts +++ b/src/manager/Configurator/types.ts @@ -3,7 +3,6 @@ import {IBreakpointSetting, TSlidesPerViewActual} from '../../types'; export interface ISetting extends IBreakpointSetting { slidesPerViewActual?: TSlidesPerViewActual moveTime?: number, - defaultActivePage?: number, autoPlayTime?: number, initStartPlayTime?: number, isDebug?: boolean, diff --git a/src/manager/Elementor/Elementor.ts b/src/manager/Elementor/Elementor.ts index 9c1b875..4c690b5 100644 --- a/src/manager/Elementor/Elementor.ts +++ b/src/manager/Elementor/Elementor.ts @@ -5,6 +5,7 @@ import {getMoveDistance, getMovePercentage, getStartPosition} from './utils'; import Configurator from '../Configurator'; import Stater from '../Stater'; import {IPercentageInfo} from '../../types'; +import {getObjectKeys} from '../../utils'; class Elementor { _rootRef: RefObject = createRef(); @@ -206,7 +207,8 @@ class Elementor { if(this._configurator.setting.moveEffect?.moveFn){ const moveStyles = this._configurator.setting.moveEffect.moveFn(percentageInfo); if(moveStyles){ - Object.keys(moveStyles).forEach(rowStyleKey => { + getObjectKeys(moveStyles).forEach(rowStyleKey => { + // @ts-ignore el.style[rowStyleKey] = moveStyles[rowStyleKey]; }); if(isUseAnimation){ diff --git a/src/types.ts b/src/types.ts index fa8faaf..96c7ccb 100644 --- a/src/types.ts +++ b/src/types.ts @@ -128,4 +128,3 @@ export type TToNext = () => void - diff --git a/src/utils.ts b/src/utils.ts index 7b0c299..4efa1a5 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -103,15 +103,17 @@ export function getLoopResetIndex(activeActualIndex: number, residue: number): n +type ObjectKeys = Array; - - +export function getObjectKeys(props: T): ObjectKeys { + return Object.keys(props) as ObjectKeys; +} export function isPropsDiff(props: IBearCarouselProps, nextProps: IBearCarouselProps, exclude: string[]) { - const filterProps = Object.keys(props) - .filter(key => typeof props[key] !== 'function' && !exclude.includes(key)) + const filterProps = getObjectKeys(props) + .filter((key) => typeof props[key] !== 'function' && !exclude.includes(key)) .map(key => props[key]); - const nextFilterProps = Object.keys(nextProps) + const nextFilterProps = getObjectKeys(nextProps) .filter(key => typeof nextProps[key] !== 'function' && !exclude.includes(key)) .map(key => nextProps[key]); diff --git a/tsconfig.json b/tsconfig.json index fbf3e9d..fb61b72 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "dom.iterable", "esnext" ], - "noImplicitAny": false, + "noImplicitAny": true, "allowJs": true, "skipLibCheck": true, "esModuleInterop": true,