From 3507a8e81d3f531ee8b883b136eaeeb4ff864fed Mon Sep 17 00:00:00 2001 From: patrikholcak Date: Fri, 11 Oct 2024 15:32:47 +0200 Subject: [PATCH 1/2] Fix options type for `options.floatingUIOptions` --- shepherd.js/src/step.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shepherd.js/src/step.ts b/shepherd.js/src/step.ts index ddb029b0c..1c74caf7b 100644 --- a/shepherd.js/src/step.ts +++ b/shepherd.js/src/step.ts @@ -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 @@ -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? From 6b0346731b55d3fc85dfb8424910645fdcc24e05 Mon Sep 17 00:00:00 2001 From: patrikholcak Date: Tue, 15 Oct 2024 15:08:47 +0200 Subject: [PATCH 2/2] Fix docs build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- shepherd.js/src/utils/floating-ui.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shepherd.js/src/utils/floating-ui.ts b/shepherd.js/src/utils/floating-ui.ts index a7312f835..ae378bb36 100644 --- a/shepherd.js/src/utils/floating-ui.ts +++ b/shepherd.js/src/utils/floating-ui.ts @@ -63,7 +63,7 @@ export function setupTooltip(step: Step): ComputePositionConfig { export function mergeTooltipConfig( tourOptions: StepOptions, options: StepOptions -) { +): { floatingUIOptions: ComputePositionConfig } { return { floatingUIOptions: deepmerge( tourOptions.floatingUIOptions || {},