Pure types, zero runtime
Type declarations only — no impact on your bundle size.
TypeScript types for MediaWiki Action API responses
Type declarations only — no impact on your bundle size.
One field union across MediaWiki 1.39–1.47.
Every field is annotated with its parameter and semantics; hover in your IDE and it is there.
Response types for common extensions — one import activates a pack.
Types are written field by field from real responses, with JSDoc marking each field's meaning and its source parameter. Hover a response field in your IDE to see it — no doc-digging needed.
import type { ApiQueryResponse } from "types-mediawiki-response";
const res = (await api.get({
action: "query",
meta: "siteinfo",
siprop: "general",
formatversion: "2",
})) as ApiQueryResponse;
const general = res.query.general;
if (!general) throw new Error("missing query.general");
console.log(`${general.sitename}: ${general.generator(property) ApiSiteGeneral.generator: stringGenerator, e.g. MediaWiki 1.43.0.}`);(property) ApiSiteGeneral.generator: stringGenerator, e.g. MediaWiki 1.43.0.Type and spelling mistakes are caught by TS at compile time. You find out earlier, and the editor suggests the correct spelling for you.
import type { ApiQueryResponse } from "types-mediawiki-response";
const res = (await api.get({
action: "query",
list: "search",
srsearch: "insource:formatversion",
formatversion: "2",
})) as ApiQueryResponse;
const [hit] = res.query.search ?? [];
console.log(`${hit.title}: ${hit.snipetProperty 'snipet' does not exist on type 'ApiSearchHit'. Did you mean snippet?ts(2551)}`);