Hey guys, does anyone know how I could type a variable in a function ? I am using alpinejs with bun and I am running into this issue a lot.
Here is what my code looks like:
const Container = () =>{
return <p x-data={pData.toString()} x-show={showP.toString()}></p>
}
const pData = () => ({
shouldBeVisible: true,
})
const showP = () => {
return shouldBeVisible; //<== type error here
}
This code works just fine, however how could I type the variable shouldBeVisible to a boolean ?
I know I can use the declare keyword but that's for global use.
Any ideas ๐ ?