Skip to content

Commit

Permalink
fix(types): avoid ts 4.2+ syntax (#2650)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Dec 6, 2023
1 parent cff301f commit 23f32f5
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-swans-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@floating-ui/core': patch
---

fix(types): avoid ts 4.2+ syntax
4 changes: 2 additions & 2 deletions packages/core/src/detectOverflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
SideObject,
} from './types';

export type Options = Partial<{
export type DetectOverflowOptions = Partial<{
/**
* The clipping element(s) or area in which overflow will be checked.
* @default 'clippingAncestors'
Expand Down Expand Up @@ -53,7 +53,7 @@ export type Options = Partial<{
*/
export async function detectOverflow(
state: MiddlewareState,
options: Options | Derivable<Options> = {},
options: DetectOverflowOptions | Derivable<DetectOverflowOptions> = {},
): Promise<SideObject> {
const {x, y, platform, rects, elements, strategy} = state;

Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/middleware/autoPlacement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import {
placements as ALL_PLACEMENTS,
} from '@floating-ui/utils';

import {
type Options as DetectOverflowOptions,
detectOverflow,
} from '../detectOverflow';
import type {DetectOverflowOptions} from '../detectOverflow';
import {detectOverflow} from '../detectOverflow';
import type {Alignment, Derivable, Middleware, Placement} from '../types';

export function getPlacementList(
Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/middleware/hide.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {evaluate, sides} from '@floating-ui/utils';

import {
type Options as DetectOverflowOptions,
detectOverflow,
} from '../detectOverflow';
import type {DetectOverflowOptions} from '../detectOverflow';
import {detectOverflow} from '../detectOverflow';
import type {Derivable, Middleware, Rect, SideObject} from '../types';

function getSideOffsets(overflow: SideObject, rect: Rect) {
Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/middleware/shift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import {
getSideAxis,
} from '@floating-ui/utils';

import {
type Options as DetectOverflowOptions,
detectOverflow,
} from '../detectOverflow';
import type {DetectOverflowOptions} from '../detectOverflow';
import {detectOverflow} from '../detectOverflow';
import type {Coords, Derivable, Middleware, MiddlewareState} from '../types';

export type ShiftOptions = Partial<
Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/middleware/size.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ import {
min,
} from '@floating-ui/utils';

import {
type Options as DetectOverflowOptions,
detectOverflow,
} from '../detectOverflow';
import type {DetectOverflowOptions} from '../detectOverflow';
import {detectOverflow} from '../detectOverflow';
import type {Derivable, Middleware, MiddlewareState} from '../types';

export type SizeOptions = Partial<
Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,7 @@ export type RootBoundary = 'viewport' | 'document' | Rect;
export type ElementContext = 'reference' | 'floating';

export {computePosition} from './computePosition';
export {
detectOverflow,
Options as DetectOverflowOptions,
} from './detectOverflow';
export {detectOverflow, DetectOverflowOptions} from './detectOverflow';
export {arrow, ArrowOptions} from './middleware/arrow';
export {autoPlacement, AutoPlacementOptions} from './middleware/autoPlacement';
export {flip, FlipOptions} from './middleware/flip';
Expand Down

0 comments on commit 23f32f5

Please sign in to comment.