Registry / devops / api-typing

api-typing

JSON →
library1.19.1jsnpmunverified

Api-Typing (v1.19.1) is a TypeScript-first HTTP client built on top of Axios that generates fully typed API interfaces from OpenAPI specifications. It automatically syncs endpoint URLs, request parameters, and response types directly from your backend's OpenAPI document, eliminating manual type maintenance. Unlike generic Axios wrappers, it provides a CLI tool to pull live OpenAPI JSON and produce .d.ts files with field-level JSDoc comments. The package offers automatic URL hints, parameter type checking, and response typing. Supports custom Axios interceptors. Ideal for teams wanting type-safe HTTP calls without writing manual type definitions.

npm install api-typing
INSTALL
IMPORT
SIG · API-TYPING
A
api-typing
devopsjavascriptv1.19.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createHTTPClient
import { createHTTPClient } from 'api-typing'
const createHTTPClient = require('api-typing')
The package is ESM-only. CommonJS require will fail.
default
import apiTyping from 'api-typing'
import { apiTyping } from 'api-typing'
Default export is the main entry point, but most users import createHTTPClient as a named export.
ApiTypingClient
import type { ApiTypingClient } from 'api-typing'
import { ApiTypingClient } from 'api-typing'
ApiTypingClient is a type-only export. Use 'import type' to avoid bundling issues.
get-types
npx get-types <openapi-url> [output-file]
get-types
The CLI tool is invoked via npx, not imported. It must be run as a script (e.g., in package.json).

Shows setup: add CLI script to package.json, run it, include generated types in tsconfig, then use createHTTPClient with type-safe requests.

// package.json scripts section { "scripts": { "get-types": "get-types \"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore-expanded.json\" \"./api-typing-meta.d.ts\"" } } // Run: npm run get-types // tsconfig.json (add to include) { "include": ["api-typing-meta.d.ts"] } // Usage import { createHTTPClient } from 'api-typing'; const client = createHTTPClient({ baseURL: 'https://petstore.example.com' }); client .post('/pets', { name: 'Buddy', tag: 'dog' }) .then((response) => { console.log(response.data); // fully typed });
Debug
Known issues
breakingType generation requires an OpenAPI v3.0 JSON URL; older Swagger 2.0 formats may not work.
fix
Convert your Swagger 2.0 spec to OpenAPI 3.0 using a tool like swagger2openapi.
affects: >=1.0.0
gotchaThe generated .d.ts file must be included in tsconfig.json 'include' array, otherwise TypeScript won't see the types.
fix
Add 'api-typing-meta.d.ts' to the 'include' field in tsconfig.json.
affects: >=1.0.0
gotchaThe CLI tool (get-types) must be run via npx; installing it globally may cause version conflicts.
fix
Use 'npx get-types ...' or add it as a npm script. Do not install globally.
affects: >=1.0.0
deprecatedIn v1.5.0, the output file default changed from 'api-typing.d.ts' to 'api-typing-meta.d.ts'.
fix
Update your tsconfig include path to 'api-typing-meta.d.ts'.
affects: >=1.5.0
breakingcreateHTTPClient now returns an AxiosInstance directly; previously it returned a custom wrapper.
fix
Use the returned object as an Axios instance (e.g., for interceptors).
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'api-typing' or its corresponding type declarations.
TypeScript cannot locate the package types because the generated .d.ts file is not included in tsconfig.
fix
Add 'api-typing-meta.d.ts' to the 'include' array in tsconfig.json.
get-types : The term 'get-types' is not recognized as the name of a cmdlet, function, script file, or operable program.
The CLI tool is not installed or invoked incorrectly (e.g., missing npx).
fix
Run 'npx get-types ...' instead of just 'get-types'.
Type error: Property 'data' does not exist on type 'AxiosResponse<unknown>'. Did you mean 'data'?
Axios version mismatch or incorrect type import.
fix
Ensure axios >= 1.0.0 is installed and use createHTTPClient from api-typing, which carries the correct response types.
Cannot use import statement outside a module
The code is running in a CommonJS environment, but api-typing is ESM-only.
fix
Add 'type': 'module' to package.json or use dynamic import().
Upgrade
Version history
1.19.1latest on npm
Audit
Dependencies
axiosrequiredUnderlying HTTP client used for all requests.
Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
api-typing — npm install api-typing · libregistry