tspace-spear
Version:
tspace-spear is a lightweight, high-performance API framework for Node.js that leverages the native HTTP server and supports uWebSockets.js (C++) for maximum speed and efficiency.
2 lines (1 loc) • 1 kB
TypeScript
export declare const ClientTemplate = "\n// for example E2E\nimport { AppRouter } from \".\";\nimport { ApiClient } from \"tspace-spear/client\";\n\nconst client: ApiClient<AppRouter> = new ApiClient(\n \"http://localhost:8000/api\"\n);\n\nasync function main() { \n \n const res = await client.get(\"/cats\");\n res.data.cats = 1 // Type error: Type 'number' is not assignable to type '{ id: number; name: string; age: number; }[]'\n res.data.cats[0].name = 1 // Type error: Type 'number' is not assignable to type 'string'\n res.data.cats[0].age = \"1.6\" // Type error: Type 'string' is not assignable to type 'number'\n\n console.log(res) \n // res.ok -> boolean\n // res.status -> number\n // res.data -> { cats: [{ id: 1, name: 'cat1', age: 1.6 },{ id: 2, name: 'cat2', age: 1.8 }] }\n\n await client.get(\"/catsq\"); // Type error: Argument of type '\"/catsq\"' is not assignable to parameter of type '\"/cats\" | \"/cats/:id\" | ... 3 more\n \n}\nmain()\n";