vue-stripe-elements icon indicating copy to clipboard operation
vue-stripe-elements copied to clipboard

Cannot resolve definitions for module 'vue-stripe-elements-plus'

Open fsproru opened this issue 4 years ago • 4 comments

Love this component! Thanks a lot for working on it. Noticed this error during TypeScript compilation looking for some type definitions.

Cannot resolve definitions for module 'vue-stripe-elements-plus'

Looks like the type definition is also missing on https://github.com/DefinitelyTyped/DefinitelyTyped. That being said, people started including the type definition inside the npm so there is no need to download a separate npm just for typings. I think adding the typings file will solve the issue.

fsproru avatar Feb 27 '20 19:02 fsproru

Hello @fsproru have you been able to solve the issue? Because I'm having this issue lately Module not found: Error: Can't resolve 'vue-stripe-elements-plus' in 'C:\xampp7\htdocs\trendle-precalc-frontend\src\pages\settings'

jamols09 avatar Aug 21 '20 09:08 jamols09

Nope, the issue is still there.

fsproru avatar Aug 21 '20 13:08 fsproru

Hi @fsproru, thanks for the relevant suggestion! I plan to rewrite the module in typescript and will add types. The package hasn't changed much in a few years. In the meantime typescript gained popularity. I'm personally excited about the transition and its benefits

softbeehive avatar Mar 22 '21 22:03 softbeehive

I just added this in a .d.ts file:

import type {
    Stripe,
    StripeConstructor,
    StripeElements,
} from "@stripe/stripe-js";
import { Component } from "vue";

declare module "vue-stripe-elements-plus" {
    export function initStripe(
        ...params: Parameters<StripeConstructor>
    ): Stripe;

    export function createElements(
        instance: Stripe,
        ...params: Parameters<Stripe["elements"]>
    ): StripeElements;

    export function createElement(
        elements: StripeElements,
        ...params: Parameters<StripeElements["create"]>
    ): ReturnType<StripeElements["create"]>;

    export const StripeElements: Component;
    export const StripeElement: Component;
}

alexsasharegan avatar May 04 '21 06:05 alexsasharegan