kit icon indicating copy to clipboard operation
kit copied to clipboard

Arg never resolves if the value of list of choices is a function

Open danielo515 opened this issue 2 years ago • 2 comments

Given this simple script:

import '@johnlindquist/kit';
const content = await clipboard.readText();
const availableTemplates = [
{ name: 'let binding',
  value: ({content}) => `let ${content} = `,
},
];

const selectedTemplate = await arg('Select one template', availableTemplates);

Arg never resolves. If I change it to be just a string, then it works fine. Given that the type definition says that type could be any, this is a surprise

danielo515 avatar Feb 03 '23 18:02 danielo515

The value does get sent and serialized between the script and the app, so it's anything serializable. I'll take a look at the types

johnlindquist avatar Feb 03 '23 18:02 johnlindquist

That makes sense. Then why is it not throwing an error or something?

On Fri, Feb 3, 2023 at 7:40 PM John Lindquist @.***> wrote:

The value does get sent and serialized between the script and the app, so it's anything serializable. I'll take a look at the types

— Reply to this email directly, view it on GitHub https://github.com/johnlindquist/kit/issues/1098#issuecomment-1416256260, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKJWMJ5UGI3DQDQSFP7HDWVVGJHANCNFSM6AAAAAAUQR6E4A . You are receiving this because you authored the thread.Message ID: @.***>

--

https://danielorodriguez.com

danielo515 avatar Feb 03 '23 19:02 danielo515