Skip to content

Commit 2b87c65

Browse files
Fixes #343 - Export missing SnackbarContent for TypeScript (#354)
* Export SnackbarContent declaration * Update generated types
1 parent e5e2fb0 commit 2b87c65

File tree

3 files changed

+61
-9
lines changed

3 files changed

+61
-9
lines changed

src/SnackbarContent/SnackbarContent.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { forwardRef } from 'react';
22
import clsx from 'clsx';
33
import { createStyles, Theme, withStyles, WithStyles } from '@material-ui/core/styles';
4+
import { SnackbarContentProps } from '../index';
45

56
const styles = (theme: Theme) => createStyles({
67
root: {
@@ -14,9 +15,9 @@ const styles = (theme: Theme) => createStyles({
1415
}
1516
});
1617

17-
interface SnackbarContentProps extends WithStyles<typeof styles>, React.HTMLAttributes<HTMLDivElement> { }
18+
interface Props extends WithStyles<typeof styles>, SnackbarContentProps { }
1819

19-
const SnackbarContent = forwardRef<HTMLDivElement, SnackbarContentProps>(({ classes, className, ...props }, ref) => (
20+
const SnackbarContent = forwardRef<HTMLDivElement, Props>(({ classes, className, ...props }, ref) => (
2021
<div ref={ref} className={clsx(classes.root, className)} {...props} />
2122
))
2223

src/index.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export interface TransitionHandlerProps {
108108
onExited: TransitionHandler;
109109
}
110110

111-
export type SnackbarContentProps = React.HTMLAttributes<HTMLDivElement>
111+
export type SnackbarContentProps = React.HTMLAttributes<HTMLDivElement>;
112112

113113
/**
114114
* @category Shared
@@ -269,6 +269,7 @@ export interface ProviderContext {
269269
export function withSnackbar<P extends ProviderContext>(component: React.ComponentType<P>):
270270
React.ComponentClass<Omit<P, keyof ProviderContext>> & { WrappedComponent: React.ComponentType<P> };
271271

272+
export declare const SnackbarContent: React.ComponentType<SnackbarContentProps & React.RefAttributes<HTMLDivElement>>;
272273

273274
export function useSnackbar(): ProviderContext;
274275

typedoc.json

+56-6
Original file line numberDiff line numberDiff line change
@@ -5471,7 +5471,7 @@
54715471
}
54725472
},
54735473
{
5474-
"id": 222,
5474+
"id": 223,
54755475
"name": "WithSnackbarProps",
54765476
"kind": 4194304,
54775477
"kindString": "Type alias",
@@ -5481,7 +5481,7 @@
54815481
"sources": [
54825482
{
54835483
"fileName": "src/index.d.ts",
5484-
"line": 276,
5484+
"line": 277,
54855485
"character": 29
54865486
}
54875487
],
@@ -5493,6 +5493,49 @@
54935493
},
54945494
{
54955495
"id": 220,
5496+
"name": "SnackbarContent",
5497+
"kind": 32,
5498+
"kindString": "Variable",
5499+
"flags": {
5500+
"isExported": true,
5501+
"isConst": true
5502+
},
5503+
"sources": [
5504+
{
5505+
"fileName": "src/index.d.ts",
5506+
"line": 272,
5507+
"character": 36
5508+
}
5509+
],
5510+
"type": {
5511+
"type": "reference",
5512+
"typeArguments": [
5513+
{
5514+
"type": "intersection",
5515+
"types": [
5516+
{
5517+
"type": "reference",
5518+
"id": 213,
5519+
"name": "SnackbarContentProps"
5520+
},
5521+
{
5522+
"type": "reference",
5523+
"typeArguments": [
5524+
{
5525+
"type": "reference",
5526+
"name": "HTMLDivElement"
5527+
}
5528+
],
5529+
"name": "RefAttributes"
5530+
}
5531+
]
5532+
}
5533+
],
5534+
"name": "React.ComponentType"
5535+
}
5536+
},
5537+
{
5538+
"id": 221,
54965539
"name": "useSnackbar",
54975540
"kind": 64,
54985541
"kindString": "Function",
@@ -5501,7 +5544,7 @@
55015544
},
55025545
"signatures": [
55035546
{
5504-
"id": 221,
5547+
"id": 222,
55055548
"name": "useSnackbar",
55065549
"kind": 4096,
55075550
"kindString": "Call signature",
@@ -5518,7 +5561,7 @@
55185561
"sources": [
55195562
{
55205563
"fileName": "src/index.d.ts",
5521-
"line": 273,
5564+
"line": 274,
55225565
"character": 27
55235566
}
55245567
]
@@ -5763,14 +5806,21 @@
57635806
205,
57645807
211,
57655808
181,
5766-
222
5809+
223
5810+
]
5811+
},
5812+
{
5813+
"title": "Variables",
5814+
"kind": 32,
5815+
"children": [
5816+
220
57675817
]
57685818
},
57695819
{
57705820
"title": "Functions",
57715821
"kind": 64,
57725822
"children": [
5773-
220,
5823+
221,
57745824
214
57755825
]
57765826
}

0 commit comments

Comments
 (0)