type isNode = ReturnType extends number ? false : true type NodeOnly = isNode extends true ? T : never type Grfn = { type: 'grfn' (...args: I): Promise } export const getSvg: ( grfn: Grfn ) => Promise export const getPng: NodeOnly<(grfn: Grfn) => Promise> export const previewInBrowser: NodeOnly<(grfn: Grfn) => Promise> export type Gifn = ( ...args: I ) => Promise<{ output: O; gif: Buffer }> export const gifn: NodeOnly< (grfn: Grfn) => Gifn >