Skip to content

Commit

Permalink
#204: Follow up
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Oct 31, 2023
1 parent 168aa63 commit f95274d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/next-appdir/DsfrHead.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo, type ReactNode } from "react";
import React, { useMemo } from "react";
import { objectKeys } from "tsafe/objectKeys";
import { getAssetUrl } from "../tools/getAssetUrl";
import AppleTouchIcon from "../dsfr/favicon/apple-touch-icon.png";
Expand All @@ -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, RegisteredLinkProps } from "../link";
import { setLink, type RegisterLink } 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
Expand All @@ -22,7 +22,7 @@ export type DsfrHeadProps = {
*/
preloadFonts?: (keyof typeof fontUrlByFileBasename)[];
/** Default: <a /> */
Link?: React.ComponentType<RegisteredLinkProps & { children: ReactNode }>;
Link?: RegisterLink extends { Link: infer Link } ? Link : undefined;
/**
* When set, the value will be used as the nonce attribute of subsequent script tags.
*
Expand Down
5 changes: 2 additions & 3 deletions src/next-appdir/zz_internal/start.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { ReactNode } from "react";
import { start } from "../../start";
import type { RegisteredLinkProps } from "../../link";
import type { RegisterLink } from "../../link";
import { setLink } from "../../link";
import { type DefaultColorScheme, setDefaultColorSchemeClientSide } from "./defaultColorScheme";
import { isBrowser } from "../../tools/isBrowser";
Expand All @@ -15,7 +14,7 @@ export function startReactDsfr(params: {
/** Default: false */
verbose?: boolean;
/** Default: <a /> */
Link?: React.ComponentType<RegisteredLinkProps & { children: ReactNode }>;
Link?: RegisterLink extends { Link: infer Link } ? Link : undefined;
/**
* When true, the nonce of the script tag will be checked, fetched from {@link DsfrHead} component and injected in react-dsfr scripts.
*
Expand Down
4 changes: 2 additions & 2 deletions src/next-pagesdir.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, type ReactNode } from "react";
import React, { useEffect } from "react";
import Head from "next/head";
import type { NextComponentType } from "next";
import DefaultApp from "next/app";
Expand Down Expand Up @@ -32,7 +32,7 @@ export type CreateNextDsfrIntegrationApiParams = {
/** Default: false */
verbose?: boolean;
/** Default: <a /> */
Link?: React.ComponentType<RegisteredLinkProps & { children: ReactNode }>;
Link?: RegisterLink extends { Link: infer Link } ? Link : undefined;
/** If not provided no fonts are preloaded.
* Preloading of fonts is only enabled in production.
*/
Expand Down
3 changes: 1 addition & 2 deletions src/spa.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { ReactNode } from "react";
import { start } from "./start";
import type { RegisterLink, RegisteredLinkProps } from "./link";
import { setLink } from "./link";
Expand All @@ -13,7 +12,7 @@ export function startReactDsfr(params: {
/** Default: false */
verbose?: boolean;
/** Default: <a /> */
Link?: React.ComponentType<RegisteredLinkProps & { children: ReactNode }>;
Link?: RegisterLink extends { Link: infer Link } ? Link : undefined;
/** Default: ()=> "fr" */
useLang?: () => string;
/**
Expand Down

0 comments on commit f95274d

Please sign in to comment.