Fix types error
parent
dd095fe03e
commit
b7b1a01819
|
@ -58,7 +58,8 @@
|
|||
},
|
||||
"resolutions": {
|
||||
"rollup": "^3.10.0",
|
||||
"@types/koa": "^2.13.6"
|
||||
"@types/koa": "^2.13.6",
|
||||
"@types/react": "^18.2.18"
|
||||
},
|
||||
"packageManager": "yarn@3.5.0",
|
||||
"engines": {
|
||||
|
|
|
@ -17,15 +17,19 @@ export default function Distribution() {
|
|||
const engine = useContext(EngineContext)
|
||||
const distribution = (
|
||||
getCotisationsBySection(useEngine().getParsedRules())
|
||||
.map(([section, cotisations]) => [
|
||||
section,
|
||||
cotisations
|
||||
.map((c) => engine.evaluate({ valeur: c, unité: targetUnit }))
|
||||
.reduce(
|
||||
(acc, evaluation) => acc + ((evaluation?.nodeValue as number) || 0),
|
||||
0
|
||||
),
|
||||
])
|
||||
.map(
|
||||
([section, cotisations]) =>
|
||||
[
|
||||
section,
|
||||
cotisations
|
||||
.map((c) => engine.evaluate({ valeur: c, unité: targetUnit }))
|
||||
.reduce(
|
||||
(acc, evaluation) =>
|
||||
acc + ((evaluation?.nodeValue as number) || 0),
|
||||
0
|
||||
),
|
||||
] as const
|
||||
)
|
||||
.filter(([, value]) => value > 0) as Array<[DottedName, number]>
|
||||
).sort(([, a], [, b]) => b - a)
|
||||
const maximum = Math.max(...distribution.map(([, value]) => value))
|
||||
|
|
|
@ -10,15 +10,18 @@
|
|||
**/
|
||||
|
||||
// @ts-ignore ignore file not exist error
|
||||
import simulationData from '../public/simulation-data-title.json'
|
||||
import simulationData from '../public/simulation-data-title.json' assert { type: 'json' }
|
||||
import { hexToHSL } from '../utils/hexToHSL'
|
||||
|
||||
type KeyofSimulationData = keyof typeof simulationData
|
||||
|
||||
const script = document.currentScript
|
||||
if (!script) {
|
||||
throw new Error('document.currentScript is null or undefined')
|
||||
}
|
||||
const iframePath =
|
||||
(script.dataset.module as keyof typeof simulationData | undefined) ||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
||||
(script.dataset.module as KeyofSimulationData | undefined) ||
|
||||
'simulateur-embauche'
|
||||
|
||||
const moduleData = simulationData[iframePath]
|
||||
|
|
|
@ -15,7 +15,13 @@
|
|||
"@/*": ["*"]
|
||||
},
|
||||
"types": ["vite/client", "vite-plugin-pwa/client"],
|
||||
"typeRoots": ["./node_modules/@types", "./types/"],
|
||||
"typeRoots": [
|
||||
"../node_modules/@types",
|
||||
"../node_modules",
|
||||
"./node_modules/@types",
|
||||
"./node_modules",
|
||||
"./types"
|
||||
],
|
||||
"noEmit": true,
|
||||
"strict": true
|
||||
},
|
||||
|
|
22
yarn.lock
22
yarn.lock
|
@ -10509,28 +10509,6 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react@npm:*":
|
||||
version: 18.0.25
|
||||
resolution: "@types/react@npm:18.0.25"
|
||||
dependencies:
|
||||
"@types/prop-types": "*"
|
||||
"@types/scheduler": "*"
|
||||
csstype: ^3.0.2
|
||||
checksum: 231d658c45abdef044a716b4502774f1585d8336d73b2f5bd68f181acbfc874b7a457686ecd29b415b43ed0922c309bab7e2cf96832d188a3f4f1b02f2af760a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react@npm:>=16":
|
||||
version: 18.0.35
|
||||
resolution: "@types/react@npm:18.0.35"
|
||||
dependencies:
|
||||
"@types/prop-types": "*"
|
||||
"@types/scheduler": "*"
|
||||
csstype: ^3.0.2
|
||||
checksum: e65670397216e037b150a509ec08189140b4c20b82b612ac00b2a7133202be2d1def1e7ee69617b2df06ab4c00c43c4ee23e84788ad661aea9664da2f27c518a
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react@npm:^18.2.18":
|
||||
version: 18.2.18
|
||||
resolution: "@types/react@npm:18.2.18"
|
||||
|
|
Loading…
Reference in New Issue