-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type Work #106
base: autocomplete
Are you sure you want to change the base?
Type Work #106
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/ianmitchell/interaction-kit/EF4FBvbMVvW5YdZpvoAws7zSCoGw |
Test script for this: import { NumberInput, SlashChoiceList, SlashCommand, StringInput } from "packages/interaction-kit/src";
const choices = SlashChoiceList.create({
key: "choice value",
label: "value",
term: "phrase"
});
const command = new SlashCommand({
name: "test",
description: "test",
options: [
new StringInput({ name: "string", required: true, description: "required string" }),
new StringInput({ name: "choice", required: true, description: "string input", choices }),
new NumberInput({ name: "numeral", description: "number input" })
],
handler: (interaction) => {
interaction.options.string // should return value | undefined
interaction.options.numeral // should return value | undefined
// which is better (watch for name conflicts):
interaction.options.choice === choices.key // returning comparing strings
interaction.options.choice // returns keyof choices
interaction.options
})
}) just stick it in the top level. Includes some notes for later, pausing this to get the new types out |
Using alii's type ideas