Equal-UI / Equal

Equal UI is a Vue 3 UI library empowered by Tailwindcss
https://equal-ui.github.io/Equal/
MIT License
1.21k stars 67 forks source link

[ Bug Report ] Using the new `useNotification` gives errors with TypeScript #298

Closed JJBocanegra closed 1 year ago

JJBocanegra commented 1 year ago

Environment

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?

itsSilver commented 1 year ago

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 commented 1 year ago

fixed in latest version