Skip to content

Commit c5fa12d

Browse files
Improve type resolution for UMD libraries
😎 found a way to make it "just work" with existing types
1 parent 1a51e34 commit c5fa12d

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed
Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,9 @@
1-
import {
2-
Component as _Component,
3-
useState as _useState,
4-
Dispatch,
5-
SetStateAction,
6-
} from 'react';
7-
8-
// Globally available modules must be declared here
9-
// Copy type definitions from @types/react/index.d.ts, because namespaces can't be re-exported
1+
import _React from 'react';
2+
import _Reactstrap from 'reactstrap';
3+
import _PropTypes from 'prop-types';
104

115
declare global {
12-
namespace React {
13-
function useState<S>(
14-
initialState: S | (() => S),
15-
): [S, Dispatch<SetStateAction<S>>];
16-
function useState<S = undefined>(): [
17-
S | undefined,
18-
Dispatch<SetStateAction<S | undefined>>
19-
];
20-
interface Component<P = {}, S = {}, SS = any>
21-
extends ComponentLifecycle<P, S, SS> {}
22-
}
23-
const Reactstrap: any;
24-
const PropTypes: any;
6+
const React: typeof _React;
7+
const Reactstrap: typeof _Reactstrap;
8+
const PropTypes: typeof _PropTypes;
259
}
26-
27-
export const test = 1;

0 commit comments

Comments
 (0)