Skip to content

Commit 9aa8a57

Browse files
committed
#204: Follow up
1 parent 4b0e334 commit 9aa8a57

File tree

5 files changed

+7
-11
lines changed

5 files changed

+7
-11
lines changed

src/link.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ type HTMLAnchorProps = DetailedHTMLProps<
1111
>;
1212

1313
// eslint-disable-next-line @typescript-eslint/no-empty-interface
14-
export interface RegisterLink {}
14+
export interface RegisterLink { }
1515

1616
export type RegisteredLinkProps = RegisterLink extends { Link: infer Link }
1717
? Omit<UnpackProps<Link>, "children">
1818
: Omit<HTMLAnchorProps, "children">;
1919

20-
let Link: (
21-
props: RegisteredLinkProps & { children: ReactNode }
22-
) => ReturnType<React.FC> = props => {
20+
let Link: React.ComponentType<RegisteredLinkProps & { children: ReactNode }> = props => {
2321
const { href, ...rest } = props as { to?: string; href?: string };
2422

2523
button: {
@@ -42,8 +40,6 @@ let Link: (
4240
return <a href={href} {...rest} />;
4341
};
4442

45-
//<a {...props} />;
46-
4743
export function setLink(params: { Link: typeof Link }): void {
4844
Link = props => {
4945
{

src/next-appdir/DsfrHead.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import FaviconIco from "../dsfr/favicon/favicon.ico";
77
import { getScriptToRunAsap } from "../useIsDark/scriptToRunAsap";
88
import { fontUrlByFileBasename } from "./zz_internal/fontUrlByFileBasename";
99
import { getDefaultColorSchemeServerSide } from "./zz_internal/defaultColorScheme";
10-
import { setLink, type RegisteredLinkProps } from "../link";
10+
import { setLink, RegisteredLinkProps } from "../link";
1111
import { assert } from "tsafe/assert";
1212
//NOTE: As of now there is no way to enforce ordering in Next Appdir
1313
//See: https://github.com/vercel/next.js/issues/16630
@@ -22,7 +22,7 @@ export type DsfrHeadProps = {
2222
*/
2323
preloadFonts?: (keyof typeof fontUrlByFileBasename)[];
2424
/** Default: <a /> */
25-
Link?: (props: RegisteredLinkProps & { children: ReactNode }) => ReturnType<React.FC>;
25+
Link?: React.ComponentType<RegisteredLinkProps & { children: ReactNode }>;
2626
/**
2727
* When set, the value will be used as the nonce attribute of subsequent script tags.
2828
*

src/next-appdir/zz_internal/start.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function startReactDsfr(params: {
1515
/** Default: false */
1616
verbose?: boolean;
1717
/** Default: <a /> */
18-
Link?: (props: RegisteredLinkProps & { children: ReactNode }) => ReturnType<React.FC>;
18+
Link?: React.ComponentType<RegisteredLinkProps & { children: ReactNode }>;
1919
/**
2020
* When true, the nonce of the script tag will be checked, fetched from {@link DsfrHead} component and injected in react-dsfr scripts.
2121
*

src/next-pagesdir.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type CreateNextDsfrIntegrationApiParams = {
3232
/** Default: false */
3333
verbose?: boolean;
3434
/** Default: <a /> */
35-
Link?: (props: RegisteredLinkProps & { children: ReactNode }) => ReturnType<React.FC>;
35+
Link?: React.ComponentType<RegisteredLinkProps & { children: ReactNode }>;
3636
/** If not provided no fonts are preloaded.
3737
* Preloading of fonts is only enabled in production.
3838
*/

src/spa.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function startReactDsfr(params: {
1313
/** Default: false */
1414
verbose?: boolean;
1515
/** Default: <a /> */
16-
Link?: (props: RegisteredLinkProps & { children: ReactNode }) => ReturnType<React.FC>;
16+
Link?: React.ComponentType<RegisteredLinkProps & { children: ReactNode }>;
1717
/** Default: ()=> "fr" */
1818
useLang?: () => string;
1919
/**

0 commit comments

Comments
 (0)