Skip to content

Commit

Permalink
Fix 'unexpected any' errors for transition props
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb531 committed Nov 24, 2024
1 parent a6e816c commit dd9b3ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/routes/(entries)/Entry.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts">
import { noopTransition } from '$routes/transitions.ts';
import { type TransitionType, noopTransition } from '$routes/transitions.ts';
interface Props {
id: string;
type: string;
transition?: any;
transition?: TransitionType;
children?: import('svelte').Snippet;
}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/(entries)/EntryImage.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts">
import { noopTransition } from '$routes/transitions.ts';
import { noopTransition, type TransitionType } from '$routes/transitions.ts';
interface Props {
href: string;
title?: string;
hiddenFromAccessibility?: boolean;
transition?: any;
transition?: TransitionType;
children?: import('svelte').Snippet;
}
Expand Down
3 changes: 3 additions & 0 deletions src/routes/transitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { cubicInOut } from 'svelte/easing';
import type { FadeParams, SlideParams, TransitionConfig } from 'svelte/transition';
import { fade, slide } from 'svelte/transition';

// A type representing a valid Svelte transition function
export type TransitionType = (node: Element) => TransitionConfig;

// A transition which combines the slide and fade transitions provided by Svelte
export function fadeSlide(node: Element, options: SlideParams): TransitionConfig {
const slideTrans = slide(node, options);
Expand Down

0 comments on commit dd9b3ca

Please sign in to comment.