Skip to content

Conversation

@IanMitchell
Copy link
Owner

Using alii's type ideas

@vercel
Copy link

vercel bot commented Jan 31, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/ianmitchell/interaction-kit/EF4FBvbMVvW5YdZpvoAws7zSCoGw
✅ Preview: https://interaction-kit-git-autocomplete-types-ianmitchell1.vercel.app

@IanMitchell
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants