Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ListSubheader] Reduce specificity of typescript type #17715

Merged
merged 3 commits into from
Oct 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions packages/material-ui/src/ListSubheader/ListSubheader.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import * as React from 'react';
import { StandardProps } from '..';
import { OverridableComponent, OverrideProps } from '../OverridableComponent';

export interface ListSubheaderProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, ListSubheaderClassKey> {
color?: 'default' | 'primary' | 'inherit';
component?: React.ElementType<React.HTMLAttributes<HTMLDivElement>>;
disableGutters?: boolean;
disableSticky?: boolean;
inset?: boolean;
export interface ListSubheaderTypeMap<P = {}, D extends React.ElementType = 'li'> {
props: P & {
color?: 'default' | 'primary' | 'inherit';
disableGutters?: boolean;
disableSticky?: boolean;
inset?: boolean;
};
defaultComponent: D;
classKey: ListSubheaderClassKey;
}

declare const ListSubheader: OverridableComponent<ListSubheaderTypeMap>;

export type ListSubheaderClassKey =
| 'root'
| 'colorPrimary'
Expand All @@ -18,6 +23,9 @@ export type ListSubheaderClassKey =
| 'sticky'
| 'gutters';

declare const ListSubheader: React.ComponentType<ListSubheaderProps>;
export type ListSubheaderProps<
D extends React.ElementType = ListSubheaderTypeMap['defaultComponent'],
P = {}
> = OverrideProps<ListSubheaderTypeMap<P, D>, D>;

export default ListSubheader;