vue-stripe-elements
vue-stripe-elements copied to clipboard
Cannot resolve definitions for module 'vue-stripe-elements-plus'
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.
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'
Nope, the issue is still there.
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
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;
}