Open json-to-typescript in Script Kit

// Name: JSON to TypeScript
// Description: Copy JSON and paste it to TypeScript interfaces
// Author: Marin Muštra
// LinkedIn: https://www.linkedin.com/in/marin-mustra
import '@johnlindquist/kit';
const JsonToTS = await npm('json-to-ts');
const json = await paste();
let types = '';
try {
const obj = JSON.parse(json);
types = `${JsonToTS(obj).join('\n\n')}\n`;
} catch (error) {
const hint = `${error.message}\nˇˇˇ\n${json}`;
await arg({ hint, description: 'ERROR', type: 'hidden' });
exit();
}
await setSelectedText(types);