diff --git a/src/next-appdir/DsfrHead.tsx b/src/next-appdir/DsfrHead.tsx index 6e30b3b6..4c7ae84d 100644 --- a/src/next-appdir/DsfrHead.tsx +++ b/src/next-appdir/DsfrHead.tsx @@ -7,7 +7,7 @@ import FaviconIco from "../dsfr/favicon/favicon.ico"; import { getScriptToRunAsap } from "../useIsDark/scriptToRunAsap"; import { fontUrlByFileBasename } from "./zz_internal/fontUrlByFileBasename"; import { getDefaultColorSchemeServerSide } from "./zz_internal/defaultColorScheme"; -import { setLink, type RegisterLink } from "../link"; +import { setLink } from "../link"; import { assert } from "tsafe/assert"; //NOTE: As of now there is no way to enforce ordering in Next Appdir //See: https://github.com/vercel/next.js/issues/16630 @@ -22,7 +22,7 @@ export type DsfrHeadProps = { */ preloadFonts?: (keyof typeof fontUrlByFileBasename)[]; /** Default: */ - Link?: RegisterLink extends { Link: infer Link } ? Link : undefined; + Link?: Function; /** * When set, the value will be used as the nonce attribute of subsequent script tags. * @@ -68,7 +68,7 @@ export function DsfrHead(props: DsfrHeadProps) { useMemo(() => { if (Link !== undefined) { - setLink({ Link }); + setLink({ "Link": Link as any }); } }, [Link]); diff --git a/src/next-appdir/zz_internal/start.ts b/src/next-appdir/zz_internal/start.ts index 667a856b..42a2bdf7 100644 --- a/src/next-appdir/zz_internal/start.ts +++ b/src/next-appdir/zz_internal/start.ts @@ -1,5 +1,4 @@ import { start } from "../../start"; -import type { RegisterLink } from "../../link"; import { setLink } from "../../link"; import { type DefaultColorScheme, setDefaultColorSchemeClientSide } from "./defaultColorScheme"; import { isBrowser } from "../../tools/isBrowser"; @@ -14,7 +13,7 @@ export function startReactDsfr(params: { /** Default: false */ verbose?: boolean; /** Default: */ - Link?: RegisterLink extends { Link: infer Link } ? Link : undefined; + Link?: Function; /** * When true, the nonce of the script tag will be checked, fetched from {@link DsfrHead} component and injected in react-dsfr scripts. * @@ -54,7 +53,7 @@ export function startReactDsfr(params: { setDefaultColorSchemeClientSide({ defaultColorScheme }); if (Link !== undefined) { - setLink({ Link }); + setLink({ "Link": Link as any }); } if (isBrowser) { diff --git a/src/next-pagesdir.tsx b/src/next-pagesdir.tsx index 9ae54f9a..9b43baa8 100644 --- a/src/next-pagesdir.tsx +++ b/src/next-pagesdir.tsx @@ -32,7 +32,7 @@ export type CreateNextDsfrIntegrationApiParams = { /** Default: false */ verbose?: boolean; /** Default: */ - Link?: RegisterLink extends { Link: infer Link } ? Link : undefined; + Link?: Function; /** If not provided no fonts are preloaded. * Preloading of fonts is only enabled in production. */ @@ -121,7 +121,7 @@ export function createNextDsfrIntegrationApi( const actions: (() => void)[] = []; if (Link !== undefined) { - setLink({ Link }); + setLink({ "Link": Link as any }); } if (useLang !== undefined) { diff --git a/src/spa.ts b/src/spa.ts index e6025bbe..6310192d 100644 --- a/src/spa.ts +++ b/src/spa.ts @@ -12,7 +12,7 @@ export function startReactDsfr(params: { /** Default: false */ verbose?: boolean; /** Default: */ - Link?: RegisterLink extends { Link: infer Link } ? Link : undefined; + Link?: Function; /** Default: ()=> "fr" */ useLang?: () => string; /** @@ -50,7 +50,7 @@ export function startReactDsfr(params: { } = params; if (Link !== undefined) { - setLink({ Link }); + setLink({ "Link": Link as any }); } if (useLang !== undefined) {