Skip to content

Commit

Permalink
Fix options type for options.floatingUIOptions (#3011)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
patrikholcak authored Oct 15, 2024
1 parent 5fdad6a commit c5bf7bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion shepherd.js/src/step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
// @ts-expect-error TODO: we don't have Svelte .d.ts files until we generate the dist
import ShepherdElement from './components/shepherd-element.svelte';
import { type Tour } from './tour.ts';
import type { ComputePositionConfig } from '@floating-ui/dom';

export type StepText =
| string
Expand Down Expand Up @@ -134,7 +135,7 @@ export interface StepOptions {
/**
* Extra [options to pass to FloatingUI]{@link https://floating-ui.com/docs/tutorial/}
*/
floatingUIOptions?: object;
floatingUIOptions?: ComputePositionConfig;

/**
* Should the element be scrolled to when this step is shown?
Expand Down
2 changes: 1 addition & 1 deletion shepherd.js/src/utils/floating-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function setupTooltip(step: Step): ComputePositionConfig {
export function mergeTooltipConfig(
tourOptions: StepOptions,
options: StepOptions
) {
): { floatingUIOptions: ComputePositionConfig } {
return {
floatingUIOptions: deepmerge(
tourOptions.floatingUIOptions || {},
Expand Down

0 comments on commit c5bf7bc

Please sign in to comment.