Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-typed

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-typed - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

21

dist/express-typed.d.ts
import express, { Response, NextFunction } from "express";
import { UnionToIntersection, WithDefault } from "./type-utils";
export type TypedResponse<Res extends Partial<TypedResponseRes> = TypedResponseRes, Info extends any[] = []> = {
status<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, {
status<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, {
status: T;
}]>;
links<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, {
links<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, {
links: T;
}]>;
sendStatus<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, {
sendStatus<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, {
sendStatus: T;
}]>;
contentType<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, {
contentType<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, {
contentType: T;
}]>;
type<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, {
type<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, {
type: T;
}]>;
format<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, {
format<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, {
format: T;
}]>;
attachment<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, {
attachment<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, {
attachment: T;
}]>;
json<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, {
json<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, {
json: T;
}]>;
jsonp<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, {
jsonp<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, {
jsonp: T;
}]>;
send<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, {
send<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, {
send: T;

@@ -38,2 +38,3 @@ }]>;

locals: Record<string, any>;
routes: any;
};

@@ -40,0 +41,0 @@ export type SendMethod = "send" | "json" | "jsonp";

{
"name": "express-typed",
"version": "0.3.0",
"version": "0.3.1",
"description": "end-to-end typesafe TypeScript wrapper for Express.js",
"repository": {
"type": "git",
"url": "https://github.com/Eliav2/express-typed"
},
"homepage": "https://github.com/Eliav2/express-typed",
"bugs": "https://github.com/Eliav2/express-typed/issues",
"type": "module",

@@ -18,3 +24,3 @@ "main": "dist/express-typed.js",

"author": "",
"license": "ISC",
"license": "MIT",
"devDependencies": {

@@ -24,4 +30,6 @@ "@types/express": "^4.17.21",

"@types/qs": "^6.9.15",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.5.2",
"express": "^4.19.2",
"supertest": "^7.0.0",
"typescript": "^5.4.2"

@@ -28,0 +36,0 @@ },

@@ -6,17 +6,16 @@ import express, { Request, Response, NextFunction } from "express";

export type TypedResponse<Res extends Partial<TypedResponseRes> = TypedResponseRes, Info extends any[] = []> = {
status<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, { status: T }]>;
links<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, { links: T }]>;
sendStatus<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, { sendStatus: T }]>;
contentType<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, { contentType: T }]>;
type<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, { type: T }]>;
format<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, { format: T }]>;
attachment<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, { attachment: T }]>;
status<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, { status: T }]>;
links<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, { links: T }]>;
sendStatus<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, { sendStatus: T }]>;
contentType<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, { contentType: T }]>;
type<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, { type: T }]>;
format<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, { format: T }]>;
attachment<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, { attachment: T }]>;
json<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, { json: T }]>;
jsonp<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, { jsonp: T }]>;
send<const T extends Res['body']>(arg: T): TypedResponse<Res, [...Info, { send: T }]>;
// } & Response<Res["ResBody"], Res["Locals"] extends Record<string, any> ? Res["Locals"] : Record<string, any>>;
json<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, { json: T }]>;
jsonp<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, { jsonp: T }]>;
send<const T extends Res["body"]>(arg: T): TypedResponse<Res, [...Info, { send: T }]>;
} & Response<Res["body"], WithDefault<Res["locals"], Record<string, any>>>;
export type TypedResponseRes = { body: any; locals: Record<string, any> };
export type TypedResponseRes = { body: any; locals: Record<string, any>; routes: any };

@@ -23,0 +22,0 @@ // The different methods that can be used to send a response, those have special meaning

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc