import '@johnlindquist/kit';
import { EditorConfig } from '@johnlindquist/kit/types/kitapp';
const JsonToTS = await npm('json-to-ts');
const TSWrapper = (string: string) => `
\`\`\`ts
${string}
\`\`\`
`
const JSONWrapper = (string: string) => `
\`\`\`json
${string}
\`\`\`
`
const editorConfig:EditorConfig = {
hint: "Write then submit to obtain results",
description: 'JSON Values to Interface',
onInputSubmit: async (input: string) => submit(input)
}
const json = await editor(editorConfig)
const obj = JSON.parse(json);
const types = `${JsonToTS(obj).join('\n\n')}\n`;
setSelectedText(types)
await div(await highlight(`# Success! Result Copied to Clipboard!
## Input:${JSONWrapper(json)}
## Output:${TSWrapper(types)}`));