Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Toast swipeDirection property does not match in TS #3170

Open
eryue0220 opened this issue Oct 8, 2024 · 0 comments
Open

[Bug] Toast swipeDirection property does not match in TS #3170

eryue0220 opened this issue Oct 8, 2024 · 0 comments

Comments

@eryue0220
Copy link

Bug report

Current Behavior

I want to write a shared component based on Toast, but the direction property has an type error, here is an example code:

import * as RadixToast from '@radix-ui/react-toast';

export function SharedToast({
  description,
  direction,
  title,
}: {
  description: string;
  direction: string;
  title: string;
}) {
  return (
    <RadixToast.Provider swipeDirection={direction as any}>
      <RadixToast.Root>
        {title ? <RadixToast.Title>{title}</RadixToast.Title> : null}
        <RadixToast.Description>{description}</RadixToast.Description>
      </RadixToast.Root>
      <RadixToast.Viewport />
    </RadixToast.Provider>
  );
}

and then it will throw an error in my vscode editor, because string is not assignable to SwipeDirection | undefined.

Expected behavior

No type check error

Reproducible example

CodeSandbox Template
See above code

Suggested solution

Maybe export type SwipeDirection

Additional context

No

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-toast 1.2.2
React n/a 18.3
Browser Chrome 131
Assistive tech n/a
Node n/a
npm/yarn npm 10.6.1
Operating System osx 14.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant