Docs / TypeScript

Typed results

run() is generic, and the ScraperMap interface supports declaration merging — register a scraper's shape once and every call to it is fully typed. Params are enforced: a missing required field is a compile error, not a runtime 400.

zpi-sdk.gen.d.ts
// The export {} makes this file a module AUGMENTATION —// without it the block would shadow the real package types.export {}; declare module "zpi-sdk" {  interface ScraperMap {    "social:instagram": {      profile: {        params: { username: string };        result: { id: string; name: string };      };    };  }}
// The export {} makes this file a module AUGMENTATION —// without it the block would shadow the real package types.export {}; declare module "zpi-sdk" {  interface ScraperMap {    "social:instagram": {      profile: {        params: { username: string };        result: { id: string; name: string };      };    };  }}

You rarely write this by hand — the codegen CLI below emits it from the live catalog.

Edit this page on GitHubWas this page helpful? ·