DEV Community

govindbisen
govindbisen

Posted on • Updated on

Some un-common Errors I am facing during work -

  1. Property 'Razorpay' does not exist on type 'Window & typeof globalThis'.

I came across this error and it was not so easy for me to solve this, that's why creating this small article.

I am working in ReactTs
you will probably use
var rzp1 = new Razorpay(options); or
var rzp1 = new window.Razorpay(options);

above your react class or function put

declare global {
  interface Window {
    // ⚠️ notice that "Window" is capitalized here
    Razorpay: any;
  }
}
Enter fullscreen mode Exit fullscreen mode

2 . Getting proxy while console.log(state) in cart Slice (Redux)

solved by

import { current } from '@reduxjs/toolkit';
...
console.log(current(state));
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
aswinasok profile image
Aswin Asok

you still you any up there, i could have gone for

  const rzp1 = new (window as any).Razorpay(options);
Enter fullscreen mode Exit fullscreen mode

what is the difference?