Skip to content

Commit c5bf7bc

Browse files
authored
Fix options type for options.floatingUIOptions (#3011)
* Fix options type for `options.floatingUIOptions` * Fix docs build Due to the way pnpm installs modules and how typescript declarations resolving works, typescript couldn’t be sure what the return type is. We can either specify the return value or cast (less safe)
1 parent 5fdad6a commit c5bf7bc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

shepherd.js/src/step.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
// @ts-expect-error TODO: we don't have Svelte .d.ts files until we generate the dist
1818
import ShepherdElement from './components/shepherd-element.svelte';
1919
import { type Tour } from './tour.ts';
20+
import type { ComputePositionConfig } from '@floating-ui/dom';
2021

2122
export type StepText =
2223
| string
@@ -134,7 +135,7 @@ export interface StepOptions {
134135
/**
135136
* Extra [options to pass to FloatingUI]{@link https://floating-ui.com/docs/tutorial/}
136137
*/
137-
floatingUIOptions?: object;
138+
floatingUIOptions?: ComputePositionConfig;
138139

139140
/**
140141
* Should the element be scrolled to when this step is shown?

shepherd.js/src/utils/floating-ui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function setupTooltip(step: Step): ComputePositionConfig {
6363
export function mergeTooltipConfig(
6464
tourOptions: StepOptions,
6565
options: StepOptions
66-
) {
66+
): { floatingUIOptions: ComputePositionConfig } {
6767
return {
6868
floatingUIOptions: deepmerge(
6969
tourOptions.floatingUIOptions || {},

0 commit comments

Comments
 (0)