Next.js Discord

Discord Forum

Cannot read properties of undefined but it is defined as enum

Unanswered
Sudhan posted this in #help-forum
Open in Discord
Avatar
SudhanOP
The error is occuring from utils/defaultData.ts line number 10 but as far as i know there are no problems in that line as well as no type errors. I don't know why this is giving error
- error utils/defaultData.ts (10:23) @ Idle
- error TypeError: (reading 'Idle')
    at eval (./utils/defaultData.ts:17:67)
    at (ssr)/./utils/defaultData.ts (/workspaces/Kyuto/.next/server/app/page.js:1086:1)
    at __webpack_require__ (/workspaces/Kyuto/.next/server/webpack-runtime.js:33:43)
    at eval (./context/User.ts:7:76)
    at (ssr)/./context/User.ts (/workspaces/Kyuto/.next/server/app/page.js:371:1)
    at __webpack_require__ (/workspaces/Kyuto/.next/server/webpack-runtime.js:33:43)
    at eval (./app/layout.tsx:11:71)
    at (ssr)/./app/layout.tsx (/workspaces/Kyuto/.next/server/app/page.js:338:1)
    at __webpack_require__ (/workspaces/Kyuto/.next/server/webpack-runtime.js:33:43)
   8 |         name: "NotWrench",
   9 |         username: "notwrench",
> 10 |         status: Status.Idle,
     |                       ^
  11 |         activity: "Playing Valorent",
  12 |         avatar: "https://cdn.discordapp.com/avatars/1113356394087862282/eced0503f807f0fa2acffc3ae3cc9fac.png"
  13 |     },


https://klee.likes-throwing.rocks/6ipz3gpDN.png

1 Reply

Avatar
SudhanOP
defaultData.ts
import { FriendChatChannel } from "@/context/FriendsChat";
import { Friend, Me, Server, Status } from "@/context/User";
import { Collection } from "@discordjs/collection";

export const Friends: Friend[] = [
    {
        id: 1,
        name: "NotWrench",
        username: "notwrench",
        status: Status.Idle,
        activity: "Playing Valorent",
        avatar: "https://cdn.discordapp.com/avatars/1113356394087862282/eced0503f807f0fa2acffc3ae3cc9fac.png"
    },
//....


Status Enum
export enum Status {
    Online = "Online",
    Offline = "Offline",
    DND = "DND",
    Idle = "Idle"
}