Skip to content

Commit

Permalink
[CardMedia] Allow generic component in TypeScript (#15098)
Browse files Browse the repository at this point in the history
- Update CardMedia.d.ts  …

- [CardMedia] Allow generic component
  • Loading branch information
Domino987 authored and eps1lon committed Apr 4, 2019
1 parent 239ceb9 commit 8db4931
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions packages/material-ui/src/CardMedia/CardMedia.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import * as React from 'react';
import { StandardProps } from '..';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';

export interface CardMediaProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, CardMediaClassKey> {
component?: React.ElementType<CardMediaProps>;
image?: string;
src?: string;
interface CardMediaTypeMap<P, D extends React.ElementType> {
props: P & {
image?: string;
src?: string;
};
defaultComponent: D;
classKey: CardMediaClassKey;
}

declare const CardMedia: OverridableComponent<CardMediaTypeMap<{}, 'div'>>;

export type CardMediaClassKey = 'root' | 'media';

declare const CardMedia: React.ComponentType<CardMediaProps>;
export type CardMediaProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<
CardMediaTypeMap<P, D>,
D
>;

export default CardMedia;

0 comments on commit 8db4931

Please sign in to comment.