refactor: améliore légèrement le typage (évite les any) (#2886)
parent
419f1c12ca
commit
d3ffa735bf
|
@ -16,8 +16,7 @@ export function CompanyDetails({
|
|||
headingTag = 'h2',
|
||||
}: {
|
||||
showSituation?: boolean
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
headingTag?: string | ComponentType<any> | undefined
|
||||
headingTag?: string | ComponentType | undefined
|
||||
}) {
|
||||
return (
|
||||
<StyledCompanyContainer>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { useRadio } from '@react-aria/radio'
|
||||
import { RadioGroupState } from '@react-stately/radio'
|
||||
import { AriaRadioProps } from '@react-types/radio'
|
||||
import { createContext, useContext, useRef } from 'react'
|
||||
import React, { createContext, useContext, useRef } from 'react'
|
||||
import { css, styled } from 'styled-components'
|
||||
|
||||
import { FocusStyle } from '@/design-system/global-style'
|
||||
|
@ -12,8 +12,7 @@ export const RadioContext = createContext<RadioGroupState | null>(null)
|
|||
type RadioProps = AriaRadioProps & {
|
||||
className?: string
|
||||
role?: string
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
visibleRadioAs?: string | React.ComponentType<any>
|
||||
visibleRadioAs?: string | React.ComponentType
|
||||
}
|
||||
|
||||
// TDOO: isDisabled style
|
||||
|
@ -137,7 +136,7 @@ export const VisibleRadio = styled.span<{ $inert?: boolean }>`
|
|||
? theme.colors.bases.primary[500]
|
||||
: theme.colors.bases.primary[700]
|
||||
};
|
||||
} :
|
||||
} :
|
||||
`
|
||||
: css`
|
||||
&:hover {
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
import { ComponentType, createContext, useContext } from 'react'
|
||||
import { css, styled } from 'styled-components'
|
||||
|
||||
import { Merge } from '@/types/utils'
|
||||
|
||||
import { SpacingKey } from '../theme'
|
||||
|
||||
const breakPoints = ['$sm', '$md', '$lg', '$xl'] as const
|
||||
|
||||
type Distribute<T extends string, U> = T extends unknown
|
||||
? { [K in T]: U }
|
||||
: never
|
||||
|
||||
type BreakPoint = '$xs' | (typeof breakPoints)[number]
|
||||
type BreakPoints = Distribute<BreakPoint, number>
|
||||
type BreakPoints = Record<BreakPoint, BreakpointConfig>
|
||||
|
||||
type ContainerContext = {
|
||||
$nbColumns: number
|
||||
|
@ -87,7 +81,7 @@ const StyledGridContainer = styled.div<Omit<ContainerContext, '$nbColumns'>>`
|
|||
);
|
||||
`
|
||||
|
||||
const StyledGridItem = styled.div<ContainerContext & Merge<BreakPoints>>`
|
||||
const StyledGridItem = styled.div<ContainerContext & BreakPoints>`
|
||||
padding-left: ${({ theme, $columnSpacing }) =>
|
||||
theme.spacing[$columnSpacing ?? 0]};
|
||||
padding-top: ${({ theme, $rowSpacing }) => theme.spacing[$rowSpacing ?? 0]};
|
||||
|
@ -111,8 +105,7 @@ type GridContainerProps = {
|
|||
columnSpacing?: number
|
||||
rowSpacing?: number
|
||||
children: React.ReactNode
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
as?: string | ComponentType<any> | undefined
|
||||
as?: string | ComponentType | undefined
|
||||
} & React.ComponentPropsWithoutRef<'div'>
|
||||
|
||||
function GridContainer({
|
||||
|
@ -145,8 +138,7 @@ function GridContainer({
|
|||
type GridItemProps = {
|
||||
children?: React.ReactNode
|
||||
className?: string
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
as?: string | ComponentType<any> | undefined
|
||||
as?: string | ComponentType | undefined
|
||||
} & Partial<Record<SpacingKey | 'xs', BreakpointConfig>> &
|
||||
React.ComponentPropsWithoutRef<'div'>
|
||||
|
||||
|
|
|
@ -5,10 +5,8 @@ export const useAxeCoreAnalysis = () => {
|
|||
const axeRef = useRef<
|
||||
| {
|
||||
default: (
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
_React: any,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
_ReactDOM: any,
|
||||
_React: unknown,
|
||||
_ReactDOM: unknown,
|
||||
_timeout: number
|
||||
) => Promise<void>
|
||||
}
|
||||
|
|
|
@ -21,10 +21,6 @@ import { Body, Intro, SmallBody } from '@/design-system/typography/paragraphs'
|
|||
import PDFDocument from './PDFDocument'
|
||||
|
||||
const IS_TOUCH_DEVICE = isOnTouchDevice()
|
||||
type SignaturePadInstance = {
|
||||
clear: () => void
|
||||
toDataURL: () => string
|
||||
}
|
||||
|
||||
type EndBlockProps = {
|
||||
fields: Array<RuleNode>
|
||||
|
@ -35,7 +31,7 @@ export default function EndBlock({ fields, missingValues }: EndBlockProps) {
|
|||
const [isCertified, setCertified] = useState(false)
|
||||
const [place, setPlace] = useState<string>()
|
||||
const engine = useContext(EngineContext)
|
||||
const signatureRef = useRef<SignaturePadInstance>()
|
||||
const signatureRef = useRef<SignaturePad | null>(null)
|
||||
const tracker = useContext(TrackingContext)
|
||||
const { colors } = useTheme()
|
||||
if (missingValues.length) {
|
||||
|
|
|
@ -251,11 +251,17 @@ function formatMonth(date: string | Date) {
|
|||
})
|
||||
}
|
||||
|
||||
interface PayloadData {
|
||||
payload: {
|
||||
info: ReactNode
|
||||
date: string | Date
|
||||
} & Record<string, Parameters<typeof formatValue>[0]>
|
||||
}
|
||||
|
||||
type CustomTooltipProps = {
|
||||
active?: boolean
|
||||
period: Period
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
payload?: any
|
||||
payload?: [PayloadData]
|
||||
dataKeys: string[]
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
interface Window {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
parentIFrame?: any
|
||||
}
|
||||
|
||||
// Types from @types/iframe-resizer are for V3 and we use V4
|
||||
declare module 'iframe-resizer' {
|
||||
export const iframeResize: (options: unknown, id: string) => void
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
declare module 'react-signature-pad-wrapper' {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const signaturePad: any
|
||||
export default signaturePad
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { createMemoryHistory } from 'history'
|
||||
import { DottedName } from 'modele-social'
|
||||
import { createStore } from 'redux'
|
||||
import { createStore, Store, StoreEnhancer } from 'redux'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import { setupSimulationPersistence } from '@/storage/persistSimulation'
|
||||
|
@ -38,14 +37,14 @@ const initialSimulation: Simulation = {
|
|||
}
|
||||
|
||||
describe('[persistence] When simulation persistence is setup', () => {
|
||||
let store: any
|
||||
let store: Store
|
||||
const setItemSpy = vi.spyOn(safeLocalStorage, 'setItem')
|
||||
|
||||
beforeEach(() => {
|
||||
store = createStore(reducers, {
|
||||
simulation: initialSimulation,
|
||||
activeTargetInput: 'sometargetinput',
|
||||
} as any)
|
||||
} as unknown as StoreEnhancer)
|
||||
|
||||
setupSimulationPersistence(store, 0)
|
||||
})
|
||||
|
@ -72,7 +71,7 @@ describe('[persistence] When simulation config is set', () => {
|
|||
const serializedPreviousSimulation =
|
||||
'{"situation":{"dotted name . other":"42"},"activeTargetInput":"someothertargetinput","foldedSteps":["someotherstep"]}'
|
||||
|
||||
let store: any
|
||||
let store: Store
|
||||
|
||||
vi.spyOn(safeLocalStorage, 'getItem').mockReturnValue(
|
||||
serializedPreviousSimulation
|
||||
|
|
Loading…
Reference in New Issue