[ts]: Typing Template Refs
đ What are you trying to do?
Hello everyone, my apologies for the interruption.
How can one determine the type of the NuxtTurnstile component in practical development?
import { NuxtTurnstile } from '#components'
// const turnstile = ref<InstanceType<typeof NuxtTurnstile> | null>()
const turnstile = useTemplateRef<typeof NuxtTurnstile>(null)
đ What have you tried?
No response
âšī¸ Additional context
No response
It works for me đ¤
import { NuxtTurnstile } from "#components";
const turnstile = ref<InstanceType<typeof NuxtTurnstile> | null>(null);
@Yizack Thank you for your response.
As mentioned in my initial reply, I attempted to write the code in this manner; however, the result was any, which is of no use to me.
devDependencies:
'@nuxtjs/turnstile':
specifier: ^0.9.7
I see, have you tried re-generating the types again using npx nuxi prepare and restarting TS server I believe sometimes when reopening the project it gives any, probably not the best to do but you could always use as workaround if you need it
const turnstile = ref<{ reset: () => void }>();
No, I have attempted to execute npx nuxi prepare, but regrettably, the outcome remains any.
Currently, this is how I have approached the issue.
ref<{ reset: () => void }>();