Skip to content

Commit

Permalink
chore: remove ts-ignore (#1262)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmonnier9 authored Oct 10, 2024
1 parent abbe54e commit 4756556
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';

import { useMemo, useState } from 'react';
import FAQLink from '#components-ui/faq-link';
import InformationTooltip from '#components-ui/information-tooltip';
import { Tag } from '#components-ui/tag';
Expand All @@ -15,6 +14,7 @@ import { ISession } from '#models/user/session';
import { formatSiret } from '#utils/helpers';
import { extractAssociationEtablissements } from '#utils/helpers/association';
import { useAPIRouteData } from 'hooks/fetch/use-API-route-data';
import { useMemo, useState } from 'react';

type IProps = {
uniteLegale: IUniteLegale;
Expand Down Expand Up @@ -58,7 +58,6 @@ function DirigeantsAssociationSection({ uniteLegale, session }: IProps) {
id="rna-dirigeants"
title="Dirigeants des associations"
isProtected
// @ts-ignore
notFoundInfo={<NoDirigeants />}
sources={[EAdministration.MI, EAdministration.DJEPVA]}
data={associationProtected}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ export function DirigeantContent({

if (dirigeant.siren) {
const defaultDenom = dirigeant.denomination || dirigeant.siren;
//@ts-ignore
infos.push([
infos.push(
<a key={dirigeant.siren} href={`/dirigeants/${dirigeant.siren}`}>
→ voir les dirigeants de {defaultDenom}
</a>,
]);
</a>
);
}
return infos;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ const AgentBilansSection: React.FC<{
head={[
'Date de dépôt',
'Année fiscale',
//@ts-ignore
<FAQLink tooltipLabel="Type">
Une entreprise peut déposer différents types de bilans :
<ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import { useRef, useState } from 'react';
import { MultiChoice } from '#components-ui/multi-choice';
import Question, { EQuestionType } from '#components/faq-parcours/question';
import { FAQTargets, allFaqArticlesByTarget } from '#models/article/faq';
import { useRef, useState } from 'react';

type IProps = {
question: EQuestionType;
Expand All @@ -13,7 +13,7 @@ export default function ParcoursQuestions({ question }: IProps) {
? question
: null;

const scrollRef = useRef(null);
const scrollRef = useRef<HTMLSpanElement | null>(null);

const [userType, setUserType] = useState(initialQuestionType ? 'all' : '');
const [questionType, setQuestionType] = useState<EQuestionType>(
Expand All @@ -22,7 +22,6 @@ export default function ParcoursQuestions({ question }: IProps) {

const scroll = () => {
if (scrollRef && scrollRef.current) {
//@ts-ignore
scrollRef.current.scrollIntoView({ behavior: 'smooth' });
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export function PDFFailed({ downloadLink }: { downloadLink: string }) {
target="_blank"
rel="noreferrer noopener"
href={downloadLink}
//@ts-ignore
onClick={window.open(downloadLink, '_blank', 'noopener,noreferrer')}
onClick={() =>
window.open(downloadLink, '_blank', 'noopener,noreferrer')
}
>
cliquez ici pour re-lancer un téléchargement dans un nouvel onglet.
</a>
Expand Down
1 change: 0 additions & 1 deletion components/finances-section/societe/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export const FinancesSocieteSection: React.FC<{
<br />
<FullTable
head={[
//@ts-ignore
<FAQLink
tooltipLabel="Indicateurs"
to="/faq/donnees-financieres"
Expand Down
2 changes: 1 addition & 1 deletion components/labels-and-certificates/rge/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import routes from '#clients/routes';
import ButtonLink from '#components-ui/button';
import FAQLink from '#components-ui/faq-link';
Expand All @@ -11,6 +10,7 @@ import { IAPINotRespondingError } from '#models/api-not-responding';
import { IRGECertification } from '#models/certifications/rge';
import { IUniteLegale } from '#models/core/types';
import { ISession } from '#models/user/session';
import React from 'react';
import { certificatLogo } from './map-certicat-to-logo';

const renovLink = (slug: string) => {
Expand Down
4 changes: 1 addition & 3 deletions components/map/map-etablissement.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/order */
'use client';

import constants from '#models/constants';
Expand All @@ -16,7 +15,7 @@ export function MapEtablissement({
etablissement: IEtablissement;
}) {
const mapContainer = useRef<HTMLDivElement>(null);
const map = useRef<Map>(null);
const map = useRef<Map | null>(null);

const coords = checkLatLng(etablissement.latitude, etablissement.longitude);

Expand All @@ -25,7 +24,6 @@ export function MapEtablissement({

const zoom = etablissement ? 12 : 4.5;

//@ts-ignore
map.current = new maplibregl.Map({
//@ts-ignore
container: mapContainer.current,
Expand Down
1 change: 0 additions & 1 deletion components/map/map-results.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/order */
'use client';

import constants from '#models/constants';
Expand Down
2 changes: 1 addition & 1 deletion components/section/data-section/client.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';
/* eslint-disable react/jsx-props-no-spreading */

import { useEffect, useState } from 'react';
import { FadeIn } from '#components-ui/animation/fade-in';
import { HeightTransition } from '#components-ui/animation/height-transition';
import { IAPINotRespondingError, isAPI404 } from '#models/api-not-responding';
Expand All @@ -12,6 +11,7 @@ import {
isUnauthorized,
} from '#models/data-fetching';
import { useTimeout } from 'hooks/use-timeout';
import { useEffect, useState } from 'react';
import { ISectionProps, Section } from '..';
import { DataSectionContent } from './content';
import DataFetchErrorExplanation from './error';
Expand Down
2 changes: 1 addition & 1 deletion components/table/full.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import styles from './styleFull.module.css';

interface ISectionProps {
head: string[];
head: (string | JSX.Element)[];
body: any[][];
id?: string;
verticalAlign?: 'top' | 'middle' | 'bottom';
Expand Down
6 changes: 2 additions & 4 deletions pages/erreur/administration/[slug].tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { GetStaticPaths, GetStaticProps } from 'next';
import { HttpNotFound } from '#clients/exceptions';
import AdministrationNotResponding from '#components/administration-not-responding';
import Meta from '#components/meta/meta-client';
import { administrationsMetaData } from '#models/administrations';
import { EAdministration } from '#models/administrations/EAdministration';
import { GetStaticPaths, GetStaticProps } from 'next';
import { NextPageWithLayout } from 'pages/_app';

const AdministrationError: NextPageWithLayout<{
Expand Down Expand Up @@ -37,11 +37,9 @@ export const getStaticPaths: GetStaticPaths = async () => {
};

export const getStaticProps: GetStaticProps = async ({ params }) => {
//@ts-ignore
const slug = params.slug as EAdministration;
const slug = params?.slug as EAdministration;

const administrationEnum = Object.keys(administrationsMetaData).find(
//@ts-ignore
(key) => administrationsMetaData[key].slug === slug
);
if (administrationEnum === undefined) {
Expand Down
4 changes: 1 addition & 3 deletions utils/helpers/formatting/categories-entreprise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const categoriesEntreprisesOptions = [
];

export const categoriesEntreprise = (code: string) => {
//@ts-ignore
const categorie = categoriesEntreprisesMap[code];
if (categorie) {
return categorie;
Expand All @@ -26,10 +25,9 @@ export const categoriesEntreprise = (code: string) => {

const formatAsMap = () => {
return categoriesEntreprisesOptions.reduce((aggregator, code) => {
//@ts-ignore
aggregator[code.value] = code.label;
return aggregator;
}, {});
}, {} as { [key: string]: string });
};

const categoriesEntreprisesMap = formatAsMap();
Expand Down
1 change: 0 additions & 1 deletion utils/static-pages/load-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export function loadAll<T extends IArticle>(
.filter((k: string) => k.indexOf('./') === 0)
.forEach((key: string, index: number) => {
const slug = key.replace('.yml', '').replace('./', '');
//@ts-ignore
articles.push({ ...values[index], slug });
});

Expand Down

0 comments on commit 4756556

Please sign in to comment.