Skip to content

Commit

Permalink
Merge pull request #13 from Eliav2:dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Eliav2 authored Jun 8, 2024
2 parents 8b90108 + d29e791 commit bad3f96
Show file tree
Hide file tree
Showing 8 changed files with 917 additions and 31 deletions.
4 changes: 2 additions & 2 deletions examples/express-typed-prisma/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import express from "express";
import logger from "morgan";
import typedRouter from "./routes/typed.routes";
import notTypedRouter from "./routes/not-typed.routes";
import typedRouter from "./routes/typed.routes.js";
import notTypedRouter from "./routes/not-typed.routes.js";

// Create Express server
export const app = express();
Expand Down
1 change: 1 addition & 0 deletions packages/express-typed/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./src/express-typed"
13 changes: 7 additions & 6 deletions packages/express-typed/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "express-typed",
"version": "0.3.1",
"version": "0.3.2",
"description": "end-to-end typesafe TypeScript wrapper for Express.js",
"repository": {
"type": "git",
Expand All @@ -9,12 +9,12 @@
"homepage": "https://github.com/Eliav2/express-typed",
"bugs": "https://github.com/Eliav2/express-typed/issues",
"type": "module",
"main": "dist/express-typed.js",
"module": "dist/express-typed.js",
"types": "dist/express-typed.d.ts",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"dev": "tsc -w",
"build": "tsup",
"dev": "tsup --watch",
"prepublishOnly": "pnpm build",
"test": "vitest",
"version": "auto-changelog -p && git add CHANGELOG.md"
Expand All @@ -30,6 +30,7 @@
"@vitest/coverage-v8": "^1.5.2",
"express": "^4.19.2",
"supertest": "^7.0.0",
"tsup": "^8.1.0",
"typescript": "^5.4.2"
},
"peerDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/express-typed/tests/demo.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ test("TypedRouter", () => {
},
}),
});



type AppRoutes = ParseRoutes<typeof typedRouter>;

type HomeGetResponse = GetRouteResponseInfo<AppRoutes, "/", "get">;
Expand Down
2 changes: 1 addition & 1 deletion packages/express-typed/tests/express-typed.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export type AppRoutes = ParseRoutes<typeof typedRouter>;
export type RouteResResolver<
Path extends keyof AppRoutes,
Method extends keyof AppRoutes[Path],
Info extends keyof GetRouteResponseInfoHelper<AppRoutes, Path, Method> | "body" = "body",
Info extends keyof GetRouteResponseInfoHelper<AppRoutes, Path, Method> | "body" = "body"
> = GetRouteResponseInfo<AppRoutes, Path, Method, Info>;

// example usage
Expand Down
3 changes: 2 additions & 1 deletion packages/express-typed/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"esModuleInterop": true,
"target": "esnext",
"noImplicitAny": true,
"moduleResolution": "node",
"moduleResolution": "Node",
"sourceMap": true,
"outDir": "dist",
"baseUrl": ".",
"skipLibCheck": true,
"strict": true,
"declaration": true,
// "emitDeclarationOnly": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
Expand Down
10 changes: 10 additions & 0 deletions packages/express-typed/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["index.ts"],
dts: true,
splitting: false,
sourcemap: true,
clean: true,
format: ["cjs", "esm"],
});
Loading

0 comments on commit bad3f96

Please sign in to comment.