Open piyushchauhan opened 2 years ago
Any updates!!
Can I help with it? I really like the idea and the module, I'd gladly help adding TS support
+1
Quick Fix: Add this to your react-app-env.d.ts
file
declare module 'use-react-screenshot' {
declare
useScreenshot
export { useScreenshot }
}
@AshishKapoor where you put this file ? I tried from root app (Next) it doesn't work. Thx
@AshishKapoor where you put this file ? I tried from root app (Next) it doesn't work. Thx
Try adding it to your next-env.d.ts
file at root. +cc @electroheadfx
Quick Fix: Add this to your
react-app-env.d.ts
filedeclare module 'use-react-screenshot' { declare useScreenshot export { useScreenshot } }
Yes, It worked for me
A more detailed type definition to use with return types and hook options.
declare module 'use-react-screenshot' {
type UseScreenshot = (options: {
type: 'image/jpeg' | 'image/png'
quality: number
}) => [string | null, (ref: HTMLDivElement) => void]
declare const useScreenshot: UseScreenshot
export { useScreenshot }
}
Hello!
I'm eager to address this issue. I recently started using this great library, and the lack of a type description is a significant problem for projects utilizing Typescript. Here are two options to tackle this issue:
Define a static TypeScript interface in the library: this is a quick solution that doesn't involve updating existing files. However, it's incomplete and wouldn't evolve with library updates.
Migrate all JavaScript files to TypeScript: It's a bit more involved but ensures consistency even in the future.
@vre2h, I'd like to pursue the second option. Is that acceptable to you? Are there any potential blockers you can think of?
Best regards, Guillaume
Yes please adding Typescript declarations would be helpful. 🙏🏻