Skip to content
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

Draft
wants to merge 6 commits into
base: autocomplete
Choose a base branch
from
Draft

Type Work #106

wants to merge 6 commits into from

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.

1 participant