diff --git a/src/app/(narrow-layout)/(pages-statiques)/modele/_components/ModeleDemoBlock.tsx b/src/app/(narrow-layout)/(pages-statiques)/modele/_components/ModeleDemoBlock.tsx
index d45cbd35c..e51b78eef 100644
--- a/src/app/(narrow-layout)/(pages-statiques)/modele/_components/ModeleDemoBlock.tsx
+++ b/src/app/(narrow-layout)/(pages-statiques)/modele/_components/ModeleDemoBlock.tsx
@@ -7,7 +7,7 @@ import { safeEvaluateHelper } from '@/publicodes-state/helpers/safeEvaluateHelpe
import type { Situation } from '@/publicodes-state/types'
import { encodeRuleName } from '@/utils/publicodes/encodeRuleName'
import type { DottedName } from '@incubateur-ademe/nosgestesclimat'
-import type { Evaluation } from 'publicodes';
+import type { Evaluation } from 'publicodes'
import Engine from 'publicodes'
import { useEffect, useMemo, useState } from 'react'
@@ -86,7 +86,7 @@ export default function ModeleDemoBlock() {
onChange(el, e.target.value === '' ? '' : e.target.value)
}
/>
- {rules?.[el]?.unité}
+ {rules?.[el]?.unité as string}
diff --git a/src/app/(simulation)/(large-layout)/actions/plus/_components/ActionPlusList.tsx b/src/app/(simulation)/(large-layout)/actions/plus/_components/ActionPlusList.tsx
index dbeb04349..401167240 100644
--- a/src/app/(simulation)/(large-layout)/actions/plus/_components/ActionPlusList.tsx
+++ b/src/app/(simulation)/(large-layout)/actions/plus/_components/ActionPlusList.tsx
@@ -42,7 +42,7 @@ export default function ActionPlusList({ actions }: Props) {
{rule.icônes || '🎯'}
{getRuleTitle(
- rule as NGCRule & { dottedName: DottedName; titre: string }
+ rule as NGCRule & { dottedName: DottedName; titre?: string }
)}
diff --git a/src/app/documentation/[...slug]/_components/documentationRouter/documentationServer/QuestionSection.tsx b/src/app/documentation/[...slug]/_components/documentationRouter/documentationServer/QuestionSection.tsx
index 5ea387d99..56a81f21c 100644
--- a/src/app/documentation/[...slug]/_components/documentationRouter/documentationServer/QuestionSection.tsx
+++ b/src/app/documentation/[...slug]/_components/documentationRouter/documentationServer/QuestionSection.tsx
@@ -2,9 +2,9 @@ import MessageIcon from '@/components/icons/MessageIcon'
import Trans from '@/components/translation/Trans'
import Card from '@/design-system/layout/Card'
import Markdown from '@/design-system/utils/Markdown'
-import type { Rule } from 'publicodes'
+import type { NGCRule } from '@incubateur-ademe/nosgestesclimat'
-export default function QuestionSection({ rule }: { rule: Rule }) {
+export default function QuestionSection({ rule }: { rule: NGCRule }) {
if (!rule.question) return null
return (
<>
diff --git a/src/app/documentation/[...slug]/_components/documentationRouter/documentationServer/calculDetail/RuleDetail.tsx b/src/app/documentation/[...slug]/_components/documentationRouter/documentationServer/calculDetail/RuleDetail.tsx
index 2e938442d..552fcc957 100644
--- a/src/app/documentation/[...slug]/_components/documentationRouter/documentationServer/calculDetail/RuleDetail.tsx
+++ b/src/app/documentation/[...slug]/_components/documentationRouter/documentationServer/calculDetail/RuleDetail.tsx
@@ -1,8 +1,11 @@
import Link from '@/components/Link'
import { capitalizeString } from '@/utils/capitalizeString'
import { encodeRuleName } from '@/utils/publicodes/encodeRuleName'
-import type { DottedName, NGCRules } from '@incubateur-ademe/nosgestesclimat'
-import type { Rule} from 'publicodes';
+import type {
+ DottedName,
+ NGCRule,
+ NGCRules,
+} from '@incubateur-ademe/nosgestesclimat'
import { utils } from 'publicodes'
const KEYS_TO_OMIT = [
@@ -24,7 +27,7 @@ const KEYS_TO_OMIT = [
'mosaique',
]
-const getRuleFormatted = (rule: Rule): Rule => {
+const getRuleFormatted = (rule: NGCRule): NGCRule => {
const ruleFormatted = { ...rule }
for (const key in ruleFormatted) {
@@ -40,7 +43,7 @@ export default function RuleDetail({
ruleData,
context,
}: {
- ruleData: Rule | string | number
+ ruleData: NGCRule | string | number
context: {
dottedName: DottedName
rules: NGCRules
diff --git a/src/publicodes-state/hooks/useRule/useContent.ts b/src/publicodes-state/hooks/useRule/useContent.ts
index 5c3701aca..373a729ba 100644
--- a/src/publicodes-state/hooks/useRule/useContent.ts
+++ b/src/publicodes-state/hooks/useRule/useContent.ts
@@ -50,7 +50,17 @@ export default function useContent({ dottedName, rule }: Props) {
[rule]
)
- const plancher = useMemo(() => rule?.rawNode['plancher'] ?? 0, [rule])
+ const plancher = useMemo(() => {
+ // By default, the plancher is 0
+ const plancherValue = rule?.rawNode['plancher']
+
+ // TODO: Deal with the case where the plancher needs to be evaluated.
+ if (typeof plancherValue === 'string') {
+ return 0
+ }
+
+ return plancherValue ?? 0
+ }, [rule])
const warning = useMemo(
() => rule?.rawNode['avertissement'],