That's my code:
type SearchProps = {
interaction:
| Command.ChatInputCommandInteraction
| Command.ContextMenuCommandInteraction;
user: User;
type: "create" | "delete" | "info";
};
type ActionData = {
create: CreateAction;
delete: DeleteAction;
info: InfoAction;
};
type CreateAction = {
type: "create";
data: {
projects: string[];
assignee_section: string;
};
};
type DeleteAction = {
type: "delete";
data: {
id: number;
};
};
type InfoAction = {
type: "info";
data: {
userId: number;
};
};
type ActionType = keyof ActionData;
export async function searchForProjectAndSection({
interaction,
user,
type,
}: SearchProps) {
if (!user || !interaction) return;
const { mongoose, asana } = user;
const taskData: Partial<ActionData[ActionType]['data']> = {}; // Using Partial to initialize an empty object
const projects = await getWorkspaceProjects(
mongoose.access_token,
mongoose.workspace
);
if (projects && projects?.length > 0) {
const option = await selectOption(
interaction,
{
customId: `task_${type}_projects`,
description: texts[type].project,
},
projects
);
switch (type) {
case "create": taskData.
}
}
}
my problem is here :
switch (type) {
case "create": taskData.
}
it don't show the data