{"id":49216,"library":"restyped-axios","title":"restyped-axios","description":"Axios wrapper with TypeScript typings for consuming RESTyped API definitions. Version 2.0.0 requires TypeScript 2.8+. Enforces type-safe HTTP requests: route paths, query parameters, request bodies, and responses are checked at compile time against a provided RESTyped interface. Differentiates from raw Axios by eliminating runtime errors from mismatched endpoints. Low release cadence; stable for RESTyped ecosystem.","status":"maintenance","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/rawrmaan/restyped-axios","tags":["javascript","typescript"],"install":[{"cmd":"npm install restyped-axios","lang":"bash","label":"npm"},{"cmd":"yarn add restyped-axios","lang":"bash","label":"yarn"},{"cmd":"pnpm add restyped-axios","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for HTTP client functionality","package":"axios","optional":true}],"imports":[{"note":"ESM default export; CJS require works but loses type inference.","wrong":"const axios = require('restyped-axios')","symbol":"default","correct":"import axios from 'restyped-axios'"},{"note":"Type import for typed instance.","wrong":null,"symbol":"RESTypedAxiosInstance","correct":"import { RESTypedAxiosInstance } from 'restyped-axios'"},{"note":"Type used for create() return type.","wrong":null,"symbol":"RESTypedAxiosClient","correct":"import { RESTypedAxiosClient } from 'restyped-axios'"}],"quickstart":{"code":"import axios from 'restyped-axios';\nimport { GiphyAPI } from 'restyped-giphy-api';\n\nconst client = axios.create<GiphyAPI>({\n  baseURL: 'http://api.giphy.com/v1',\n});\n\nclient.request({\n  url: '/gifs/trending',\n  params: { api_key: process.env.KEY ?? '' },\n}).then(response => {\n  console.log(response.data.data[0].url);\n});","lang":"typescript","description":"Demonstrates creating a typed Axios client with RESTyped API definition and making a request with typed params."},"warnings":[{"fix":"Update TypeScript to 2.8+ or use restyped-axios@1.x for TS 2.4-2.7.","message":"Version 2.0.0 drops support for TypeScript <2.8","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use client.request({ url, params }) instead of client.get(url, { params }).","message":"GET requests with query params cannot use client.get() – only client.request() provides type-checked params","severity":"gotcha","affected_versions":"*"},{"fix":"Use client.post<'/posts/:id/like'>('/posts/3/like') instead of plain call.","message":"Route parameters (e.g., /posts/:id/like) require explicit generic declaration to avoid compile error","severity":"gotcha","affected_versions":"*"},{"fix":"Lock axios to version ^0.27.0 or check compatibility.","message":"Peer dependency on axios may not be compatible with newer axios versions (v1.x)","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.0.0':15 '2.8':18 'api':12 'axio':3,4,46 'bodi':30 'cadenc':56 'check':34 'compil':36 'consum':10 'definit':13 'differenti':43 'ecosystem':60 'elimin':48 'endpoint':53 'enforc':19 'error':50 'http':23 'interfac':42 'javascript':61 'low':54 'mismatch':52 'paramet':28 'path':26 'provid':40 'queri':27 'raw':45 'releas':55 'request':24,29 'requir':16 'respons':32 'restyp':2,11,41,59 'restyped-axio':1 'rout':25 'runtim':49 'safe':22 'stabl':57 'time':37 'type':8,21 'type-saf':20 'typescript':7,17,62 'version':14 'wrapper':5","created_at":"2026-06-07T17:00:38.517799+00:00","updated_at":"2026-06-07T17:00:38.517799+00:00","problems":[{"fix":"Add explicit generic: client.post<'/posts/:id/like'>('/posts/3/like')","cause":"Using generic method like client.post without explicit generic route type for path parameters.","error":"Type argument cannot be inferred from usage. Consider specifying the type arguments explicitly."},{"fix":"Check the route exists in the API definition and parameters match the expected types.","cause":"Calling a method with an invalid route or wrong parameter types due to strict RESTyped definition.","error":"Argument of type 'X' is not assignable to parameter of type 'never'."},{"fix":"Run npm install restyped-axios and ensure tsconfig.json includes node_modules type resolution.","cause":"Missing installation or TypeScript not resolving types correctly.","error":"Cannot find module 'restyped-axios' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/rawrmaan/restyped-axios#readme","github":"https://github.com/rawrmaan/restyped-axios","docs":null,"changelog":null,"pypi":null,"npm":"restyped-axios","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}