Skip to content

Commit bb23e80

Browse files
author
Chance Strickland
committed
import types explicitly
1 parent da74307 commit bb23e80

File tree

17 files changed

+53
-46
lines changed

17 files changed

+53
-46
lines changed

packages/accordion/src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
} from "@reach/utils";
2424
import {
2525
createDescendantContext,
26-
Descendant,
2726
DescendantProvider,
2827
useDescendant,
2928
useDescendantKeyDown,
@@ -32,6 +31,8 @@ import {
3231
import { useId } from "@reach/auto-id";
3332
import PropTypes from "prop-types";
3433

34+
import type { Descendant } from "@reach/descendants";
35+
3536
const AccordionDescendantContext = createDescendantContext<AccordionDescendant>(
3637
"AccordionDescendantContext"
3738
);

packages/alert-dialog/src/index.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@
3131
*/
3232

3333
import * as React from "react";
34-
import {
35-
DialogOverlay,
36-
DialogContent,
37-
DialogProps,
38-
DialogContentProps,
39-
} from "@reach/dialog";
34+
import { DialogOverlay, DialogContent } from "@reach/dialog";
4035
import { useId } from "@reach/auto-id";
4136
import {
4237
createNamedContext,
@@ -48,6 +43,8 @@ import {
4843
import invariant from "invariant";
4944
import PropTypes from "prop-types";
5045

46+
import type { DialogProps, DialogContentProps } from "@reach/dialog";
47+
5148
let AlertDialogContext = createNamedContext<AlertDialogContextValue>(
5249
"AlertDialogContext",
5350
{} as AlertDialogContextValue

packages/alert/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
import * as React from "react";
2626
import * as ReactDOM from "react-dom";
27-
import VisuallyHidden from "@reach/visually-hidden";
27+
import { VisuallyHidden } from "@reach/visually-hidden";
2828
import {
2929
forwardRefWithAs,
3030
getOwnerDocument,

packages/checkbox/src/custom.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ import {
4242
} from "@reach/utils";
4343
import {
4444
internal_checkedPropToStateValue as checkedPropToStateValue,
45-
MixedOrBool,
4645
internal_useControlledSwitchWarning as useControlledSwitchWarning,
4746
useMixedCheckbox,
48-
UseMixedCheckboxProps,
4947
} from "./mixed";
5048
import PropTypes from "prop-types";
5149

50+
import type { MixedOrBool, UseMixedCheckboxProps } from "./mixed";
51+
5252
////////////////////////////////////////////////////////////////////////////////
5353

5454
const CustomCheckboxContext = createNamedContext(

packages/checkbox/src/mixed.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,11 @@ import {
3939
warning,
4040
wrapEvent,
4141
} from "@reach/utils";
42-
import {
43-
assign,
44-
MachineEventWithRefs,
45-
StateMachine,
46-
useCreateMachine,
47-
useMachine,
48-
} from "@reach/machine";
42+
import { assign, useCreateMachine, useMachine } from "@reach/machine";
4943
import PropTypes from "prop-types";
5044

45+
import type { MachineEventWithRefs, StateMachine } from "@reach/machine";
46+
5147
// Used for development only, not recommended for production code!
5248
const DEBUG = false;
5349

packages/combobox/src/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ import {
3636
} from "@reach/utils";
3737
import {
3838
createDescendantContext,
39-
Descendant,
4039
DescendantProvider,
4140
useDescendant,
4241
useDescendants,
4342
useDescendantsInit,
4443
} from "@reach/descendants";
4544
import { findAll } from "highlight-words-core";
4645
import { useId } from "@reach/auto-id";
47-
import Popover, { positionMatchWidth, PopoverProps } from "@reach/popover";
46+
import { Popover, positionMatchWidth } from "@reach/popover";
47+
48+
import type { PopoverProps } from "@reach/popover";
49+
import type { Descendant } from "@reach/descendants";
4850

4951
////////////////////////////////////////////////////////////////////////////////
5052
// States

packages/dialog/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
import * as React from "react";
14-
import Portal from "@reach/portal";
14+
import { Portal } from "@reach/portal";
1515
import {
1616
forwardRefWithAs,
1717
getOwnerDocument,

packages/listbox/src/index.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@
2727
import * as React from "react";
2828
import PropTypes from "prop-types";
2929
import { useId } from "@reach/auto-id";
30-
import Popover, { PopoverProps, positionMatchWidth } from "@reach/popover";
30+
import { Popover, positionMatchWidth } from "@reach/popover";
3131
import {
3232
createDescendantContext,
33-
Descendant,
3433
DescendantProvider,
3534
useDescendant,
3635
useDescendantKeyDown,
@@ -39,7 +38,6 @@ import {
3938
} from "@reach/descendants";
4039
import {
4140
createNamedContext,
42-
DistributiveOmit,
4341
forwardRefWithAs,
4442
isBoolean,
4543
isFunction,
@@ -53,15 +51,22 @@ import {
5351
useIsomorphicLayoutEffect as useLayoutEffect,
5452
wrapEvent,
5553
} from "@reach/utils";
56-
import { StateMachine, useCreateMachine, useMachine } from "@reach/machine";
54+
import { useCreateMachine, useMachine } from "@reach/machine";
5755
import {
5856
createMachineDefinition,
5957
ListboxEvents,
6058
ListboxStates,
59+
} from "./machine";
60+
61+
import type { Descendant } from "@reach/descendants";
62+
import type { DistributiveOmit } from "@reach/utils";
63+
import type { StateMachine } from "@reach/machine";
64+
import type {
6165
ListboxNodeRefs,
6266
ListboxStateData,
6367
ListboxEvent,
6468
} from "./machine";
69+
import type { PopoverProps } from "@reach/popover";
6570

6671
const DEBUG = false;
6772

packages/listbox/src/machine.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { assign, MachineEventWithRefs, StateMachine } from "@reach/machine";
1+
import { assign } from "@reach/machine";
22
import { getOwnerDocument } from "@reach/utils";
3-
import { ListboxDescendant, ListboxValue } from "./index";
3+
4+
import type { ListboxDescendant, ListboxValue } from "./index";
5+
import type { MachineEventWithRefs, StateMachine } from "@reach/machine";
46

57
////////////////////////////////////////////////////////////////////////////////
68
// States

packages/machine/src/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ import * as React from "react";
22
import {
33
assign,
44
createMachine,
5-
EventObject as MachineEvent,
65
interpret,
76
InterpreterStatus,
7+
} from "@xstate/fsm";
8+
import { isString, useConstant } from "@reach/utils";
9+
10+
import type { DistributiveOmit } from "@reach/utils";
11+
import type {
12+
EventObject as MachineEvent,
813
StateMachine,
914
Typestate,
1015
} from "@xstate/fsm";
11-
import { DistributiveOmit, isString, useConstant } from "@reach/utils";
1216

1317
const getServiceState = <
1418
TContext extends object,
@@ -214,5 +218,5 @@ export type MachineService<
214218
> = StateMachine.Service<TC, TE>;
215219

216220
// Export types and functions from xstate/fsm
217-
export { InterpreterStatus, MachineEvent, StateMachine };
218-
export { createMachine, assign, interpret };
221+
export type { MachineEvent, StateMachine };
222+
export { InterpreterStatus, createMachine, assign, interpret };

0 commit comments

Comments
 (0)