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 Report ] Using the new useNotification gives errors with TypeScript #298

Closed
JJBocanegra opened this issue Apr 20, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@JJBocanegra
Copy link

JJBocanegra commented Apr 20, 2023

Environment

  • node: 16.17.0
  • equal: 0.92.0

Current Behavior

import { useNotification } from 'equal-vue';

const notification = useNotification();

notification({ variant: 'success', title: 'Title' }); // Error: Expected 2 arguments, but got 1.

When looking at the declarations file, I find this

(): (options: Partial<INotificationOptions> | undefined, children: VNode) => (onClose?: (() => void) | undefined) => void;

So it's actually expecting two parameters.

Expected Behavior

I should be able to use notification() with only the options parameter.

Steps To Reproduce

  1. Project with Vue 3 and TypeScript
  2. Use <script setup lang="ts"> in any Vue component.
  3. Place the code inside
  4. See the error

Anything else?

Is the documentation outdated or is the declaration wrong?

@JJBocanegra JJBocanegra added the bug Something isn't working label Apr 20, 2023
@itsSilver
Copy link

itsSilver commented May 13, 2023

edit:
managed to make it working by setting the ts type to any for notification:

import { useNotification } from 'equal-vue'
const notification: any = useNotification()

@quatrochan
Copy link
Collaborator

fixed in latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants