Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
chore(build): met à jour typescript en version 5 (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBitard committed May 11, 2023
1 parent 7137e8b commit 0fdb11b
Show file tree
Hide file tree
Showing 7 changed files with 997 additions and 1,078 deletions.
2,053 changes: 984 additions & 1,069 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
"stream-json": "^1.7.5",
"ts-node": "^10.9.1",
"tus-node-server": "^0.9.0",
"typescript": "^4.9.5",
"xlsx": "^0.18.5",
"xstate": "^4.37.0"
},
Expand All @@ -120,8 +119,8 @@
"eslint-plugin-sql": "^2.3.2",
"eslint-plugin-tsdoc": "^0.2.1",
"pg-escape": "^0.2.0",
"prettier-eslint": "^15.0.1",
"supertest": "^6.3.3",
"typescript": "^5.0.4",
"vitest": "^0.29.2"
},
"prettier": {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/business/rules/titre-activites-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const titreActiviteSectionsBuild = (

if (!isSubstancesFiscales(s) && s.elements) {
elements = titreActiviteSectionElementsFormat(s.elements, periodeId, date)
} else if (['gra', 'grx'].includes(activiteTypeId) && s.id === 'substancesFiscales') {
} else if (['gra', 'grx'].includes(activiteTypeId) && isSubstancesFiscales(s)) {
const substances = titreEtapePropFind('substances', toCaminoDate(date), titreDemarches, titreTypeId) as SubstanceLegaleId[] | null

if (substances?.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ export const contenuNumbersCheck = (sections: DeepReadonly<Section[]>, contenu:
if (!section.elements) return errors

return section.elements.reduce((errors, element) => {
if (element.type === 'number' && contenu[section.id] && contenu[section.id][element.id] && contenu[section.id][element.id]! < 0) {
errors.push(`le champ "${element.id}" ne peut pas avoir une valeur négative`)
if (element.type === 'number' && contenu[section.id] && contenu[section.id][element.id]) {
const value = contenu[section.id][element.id]

if (typeof value === 'number' && value < 0) {
errors.push(`le champ "${element.id}" ne peut pas avoir une valeur négative`)
}
}

return errors
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@typescript-eslint/parser": "^5.55.0",
"@vitest/coverage-c8": "^0.29.2",
"prettier": "^2.8.4",
"typescript": "^4.9.5",
"typescript": "^5.0.4",
"vitest": "^0.29.2"
},
"prettier": {
Expand Down
5 changes: 3 additions & 2 deletions packages/common/src/static/activitesTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ export type ActiviteType<T = ActivitesTypesId> = {
sections: DeepReadonly<ActiviteSection[]>
}

export const isSubstancesFiscales = (section: DeepReadonly<ActiviteSection>): section is { id: 'substancesFiscales'; nom: string } => section.id === 'substancesFiscales'
type SubstancesFiscalesSection = { id: 'substancesFiscales'; nom: string }
export const isSubstancesFiscales = (section: DeepReadonly<ActiviteSection>): section is DeepReadonly<SubstancesFiscalesSection> => section.id === 'substancesFiscales'

export type ActiviteSection = (Omit<Section, 'elements'> & { elements: ActiviteSectionElement[] }) | { id: 'substancesFiscales'; nom: string }
export type ActiviteSection = (Omit<Section, 'elements'> & { elements: ActiviteSectionElement[] }) | SubstancesFiscalesSection
export type ActiviteSectionElement = SectionsElement & { periodeId?: 1 | 2 | 3 | 4 }

export const ActivitesTypes: {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"prettier": "^2.8.4",
"rollup-plugin-visualizer": "^5.9.0",
"storybook": "^7.0.8",
"typescript": "^4.9.5",
"typescript": "^5.0.4",
"typescript-plugin-css-modules": "^4.2.3",
"vite": "^4.1.4",
"vitest": "^0.29.2",
Expand Down

0 comments on commit 0fdb11b

Please sign in to comment.