N
Nuxtβ€’2y ago
Just Simeon

Create custom TypeScript types and make the available globally

Hello, as you can read in the Title I want to create custom TypeScript Types. In React I had a folder names "types" in the root Directory. And while I can do the same thing here and also import them, once I reload the Page I get '/_nuxt/types/Message.ts' does not provide an export named 'Message' is ther a way to fix this?
25 Replies
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Just Simeon
Just Simeonβ€’2y ago
How would I import that? Importing it like this: import {Message} from '~/types/ doesn't work But yes that did get me a step closer, now I just need to import it
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Just Simeon
Just Simeonβ€’2y ago
This is my index.ts in /types/ https://paste.teamhelios.dev/7LnZ15X7n2 and unfortunately it doesn't auto import
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Just Simeon
Just Simeonβ€’2y ago
With no import ahh okay, let me try Ahh maybe its caused by me using it in defineProps?
const input = defineProps({
msg: {
type: Message,
required: true,
});
const input = defineProps({
msg: {
type: Message,
required: true,
});
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Just Simeon
Just Simeonβ€’2y ago
not entirely sure I will try now it does complain tho that I am using a type as a value tho
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Just Simeon
Just Simeonβ€’2y ago
ReferenceError: Message is not defined
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Just Simeon
Just Simeonβ€’2y ago
Take your time
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Just Simeon
Just Simeonβ€’2y ago
No description
Unknown User
Unknown Userβ€’2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server