Skip to content

Commit

Permalink
Merge pull request #1 from web-bee-ru/DEVTASKS-44
Browse files Browse the repository at this point in the history
Devtasks 44 - Переписать TypedRest -> TypedHttp (taxios) и опубликовать в npm (Часть 1)
  • Loading branch information
Denwa799 authored Jan 11, 2024
2 parents d50772b + cfa236c commit f29349e
Show file tree
Hide file tree
Showing 11 changed files with 5,883 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
tsconfigRootDir: __dirname,
sourceType: "module",
},
plugins: ["@typescript-eslint/eslint-plugin"],
extends: ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
root: true,
env: {
browser: true,
},
ignorePatterns: [".eslintrc.js"],
rules: {
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-types": "error",
"prettier/prettier": ["error", { printWidth: 100 }],
"prettier/prettier": ["error", { endOfLine: "auto" }],
},
};
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"printWidth": 100,
"useTabs": false,
"bracketSameLine": false
}
47 changes: 47 additions & 0 deletions example/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export interface TestApi {
version: "1";
routes: {
"/test1": {
GET: {
query: {
name: string;
};
params: {
id: string;
};
response: {
id: "string";
data: object;
};
};
};
"/test2": {
GET: {
query: {
name2: string;
};
params: {
id2: string;
};
response: {
id2: string;
data2: object;
};
};
};
"/test3": {
GET: {
query: {
name3: string;
};
params: {
id3: string;
};
response: {
id3: string;
data3: object;
};
};
};
};
}
9 changes: 9 additions & 0 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { HttpResponse, http } from "msw";
import { TypedHttp } from "src";
import { TestApi } from "./data";

const typedHttp = new TypedHttp<TestApi>(http);

typedHttp.get("/test1", async ({ request, params }) => {
return HttpResponse.text("test");
});
Loading

0 comments on commit f29349e

Please sign in to comment.