Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 97a7af8

Browse files
committed
fix typings
1 parent 6a54173 commit 97a7af8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/react/src/components/Image/Image.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { ThemeContext } from 'react-fela'
1919
import { createShorthandFactory, UIComponentProps, commonPropTypes } from '../../utils'
2020
import { PropsOfElement, ProviderContextPrepared } from '../../types'
2121

22-
export interface ImageOwnProps<E extends React.ElementType = React.ElementType>
22+
export interface ImageOwnProps<E extends React.ElementType>
2323
extends UIComponentProps,
2424
ImageBehaviorProps {
2525
as?: E
@@ -45,8 +45,10 @@ export interface ImageOwnProps<E extends React.ElementType = React.ElementType>
4545
src?: string
4646
}
4747

48-
export type ImageProps<E extends React.ElementType = React.ElementType> = ImageOwnProps<E> &
49-
Omit<PropsOfElement<E>, keyof ImageOwnProps>
48+
export type ImageStrictProps<E extends React.ElementType> = ImageOwnProps<E> &
49+
Omit<PropsOfElement<E>, keyof ImageOwnProps<E>>
50+
51+
export type ImageProps = ImageStrictProps<any>
5052

5153
/**
5254
* An Image is a graphic representation of something.
@@ -59,7 +61,9 @@ export type ImageProps<E extends React.ElementType = React.ElementType> = ImageO
5961
* - when image has role='presentation' then screen readers navigate to the element in scan/virtual mode. To avoid this, the attribute "aria-hidden='true'" is applied by the default image behavior.
6062
* - when alt property is used in combination with aria-label, arialabbeledby or title, additional screen readers verification is needed as each screen reader handles this combination differently.
6163
*/
62-
function Image<E extends React.ElementType = 'img'>(props: ImageProps<E>): React.ReactElement {
64+
function Image<E extends React.ElementType = 'img'>(
65+
props: ImageStrictProps<E>,
66+
): React.ReactElement {
6367
const context: ProviderContextPrepared = React.useContext(ThemeContext)
6468
const { setStart, setEnd } = useTelemetry(Image.displayName, context.telemetry)
6569
setStart()

0 commit comments

Comments
 (0)