Skip to content

Commit

Permalink
fix: some ts errors (#1352)
Browse files Browse the repository at this point in the history
  • Loading branch information
emersonlaurentino authored Jun 9, 2022
1 parent a2f341e commit 5268188
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
6 changes: 3 additions & 3 deletions packages/sdk/src/cart/Cart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PropsWithChildren } from 'react'
import React, { createContext, useMemo } from 'react'
import type { FC } from 'react'

import { useStorage } from '../storage/useStorage'
import { SDKError } from '../utils/error'
Expand Down Expand Up @@ -57,14 +57,14 @@ export interface Props {
onItemRemove?: (item?: Item) => void
}

export const CartProvider: FC<Props> = ({
export const CartProvider = ({
children,
onItemAdd,
initialCart,
onItemRemove,
onItemUpdate,
namespace: nspc = 'main',
}) => {
}: PropsWithChildren<Props>) => {
const namespace = `${nspc}::store::cart`
const [cart, setCart] = useStorage(namespace, () => ({
...initialState,
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/search/Provider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FC } from 'react'
import type { PropsWithChildren } from 'react'
import React, { createContext, useMemo } from 'react'

import type { State as SearchState } from '../types'
Expand All @@ -18,12 +18,12 @@ type Props = SearchState & {
itemsPerPage: number
}

export const Provider: FC<Props> = ({
export const Provider = ({
children,
itemsPerPage,
onChange,
...rest
}) => {
}: PropsWithChildren<Props>) => {
const { state, ...searchActions } = useSearchState(rest, onChange)
const { pages, ...infiniteActions } = useSearchInfiniteState(state.page)

Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/ui/Provider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Dispatch, PropsWithChildren } from 'react'
import React, { createContext, useMemo, useReducer } from 'react'
import type { FC, Dispatch } from 'react'

interface BaseState {
displayMinicart: boolean
Expand Down Expand Up @@ -75,12 +75,12 @@ interface Props {

const defaultEffects: Effects = () => ({})

export const Provider: FC<Props> = ({
export const Provider = ({
children,
actions = {},
effects = defaultEffects,
initialState = {},
}) => {
}: PropsWithChildren<Props>) => {
const [state, dispatch] = useReducer(reducer(actions), {
...baseInitialState,
...initialState,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/atoms/Slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const Slider = ({
const range = useRef<HTMLDivElement>(null)

const getPercent = useCallback(
(value) => Math.round(((value - min) / (max - min)) * 100),
(value: number) => Math.round(((value - min) / (max - min)) * 100),
[min, max]
)

Expand Down
16 changes: 8 additions & 8 deletions packages/ui/src/atoms/Spinner/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { PropsWithChildren } from 'react'
import React, { forwardRef } from 'react'

export type SpinnerProps = {
Expand All @@ -7,13 +8,12 @@ export type SpinnerProps = {
testId?: string
}

const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(function Spinner(
{ children, testId = 'store-spinner', ...otherProps },
ref
) {
return (
<span ref={ref} data-store-spinner data-testid={testId} {...otherProps} />
)
})
const Spinner = forwardRef<HTMLDivElement, PropsWithChildren<SpinnerProps>>(
function Spinner({ children, testId = 'store-spinner', ...otherProps }, ref) {
return (
<span ref={ref} data-store-spinner data-testid={testId} {...otherProps} />
)
}
)

export default Spinner
5 changes: 4 additions & 1 deletion packages/ui/src/molecules/Carousel/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ function Carousel({
const preRenderedSlides =
infiniteMode && children ? childrenArray.slice(childrenCount - 1) : []

const slides = preRenderedSlides.concat(children ?? [], postRenderedSlides)
const slides = preRenderedSlides.concat(
(children as any) ?? [],
postRenderedSlides
)

const slidePrevious = () => {
if (
Expand Down

1 comment on commit 5268188

@vercel
Copy link

@vercel vercel bot commented on 5268188 Jun 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.