You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Name: Generate scripts.d.ts// Description: Enables autocompletion for the `run` commandimport"@johnlindquist/kit"import{writeFile}from"node:fs/promises"constscripts=awaitgetScripts()constavailableScripts=scripts.map((x)=>` | "${x.command}"`).join("\n")constbody=`// Do not edit. Autogenerated by generate-scripts-declarations.tsimport type { Run } from "../../.kit/types/kit"type AvailableScript = ${availableScripts};declare module "@johnlindquist/kit/types/kit" { export interface Run { // biome-ignore lint/style/useShorthandFunctionType: <explanation> (command?: AvailableScript, ...args: string[]): Promise<any> }}declare global { var run: Run}`awaitensureDir(kenvPath("@types"))awaitwriteFile(kenvPath("@types","scripts.d.ts"),body,{encoding: "utf-8"})
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This script generates a
scripts.d.ts
file that annotates therun
command with the available script names, using declaration merging.webstorm64_TN5VPomd3y.mp4
Open generate-scripts-declarations in Script Kit
Beta Was this translation helpful? Give feedback.
All reactions