mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-04 20:02:54 +02:00
refactor: prepare types for React 19 (#10746)
This commit is contained in:
parent
e9f0641620
commit
f9825af43e
296 changed files with 1105 additions and 915 deletions
|
@ -13,7 +13,12 @@
|
|||
* full state object.
|
||||
*/
|
||||
declare module '@slorber/react-ideal-image' {
|
||||
import type {ComponentProps, ComponentType, CSSProperties} from 'react';
|
||||
import type {
|
||||
ComponentProps,
|
||||
ComponentType,
|
||||
CSSProperties,
|
||||
ReactNode,
|
||||
} from 'react';
|
||||
|
||||
export type LoadingState = 'initial' | 'loading' | 'loaded' | 'error';
|
||||
|
||||
|
@ -115,5 +120,5 @@ declare module '@slorber/react-ideal-image' {
|
|||
width: number;
|
||||
}
|
||||
|
||||
export default function IdealImage(props: ImageProps): JSX.Element;
|
||||
export default function IdealImage(props: ImageProps): ReactNode;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ declare module '@docusaurus/plugin-ideal-image' {
|
|||
}
|
||||
|
||||
declare module '@theme/IdealImage' {
|
||||
import type {ComponentProps} from 'react';
|
||||
import type {ComponentProps, ReactNode} from 'react';
|
||||
|
||||
export type SrcType = {
|
||||
width: number;
|
||||
|
@ -72,5 +72,5 @@ declare module '@theme/IdealImage' {
|
|||
export interface Props extends ComponentProps<'img'> {
|
||||
readonly img: {default: string} | {src: SrcImage; preSrc: string} | string;
|
||||
}
|
||||
export default function IdealImage(props: Props): JSX.Element;
|
||||
export default function IdealImage(props: Props): ReactNode;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, {type ReactNode} from 'react';
|
||||
import ReactIdealImage, {
|
||||
type IconKey,
|
||||
type State,
|
||||
|
@ -80,7 +80,7 @@ function getMessage(icon: IconKey, state: State) {
|
|||
}
|
||||
}
|
||||
|
||||
export default function IdealImage(props: Props): JSX.Element {
|
||||
export default function IdealImage(props: Props): ReactNode {
|
||||
const {img, ...propsRest} = props;
|
||||
|
||||
// In dev env just use regular img with original file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue