add some id and http types

This commit is contained in:
2023-08-20 20:13:43 -07:00
parent c46c33eebf
commit 1d7a49ced1
7 changed files with 73 additions and 24 deletions

20
src/http.d.ts vendored Normal file
View File

@@ -0,0 +1,20 @@
/** */
export type HttpVerb
= 'GET'
| 'HEAD'
| 'POST'
| 'PUT'
| 'DELETE'
| 'OPTIONS'
;
/** */
export type HttpVerbExtended
= HttpVerb
| 'PATCH'
| 'QUERY'
| 'CONNECT'
| 'TRACE'
;

6
src/identifiers.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
export type HttpURL = `http://${string}` | `https://${string}`;
export type UUID = `${string}-${string}-${string}-${string}-${string}`;
export type SnowflakeID = `${bigint}`;

4
src/index.d.ts vendored
View File

@@ -1,2 +1,4 @@
export function hello() : string;
export * from './http';
export * from './identifiers';
export * from './logger';

19
src/logger.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
// These types are based on / compatible with the pino Logger object
export interface LogFn {
<T extends object>(obj: T, msg?: string, ...args: any[]): void;
(obj: unknown, msg?: string, ...args: any[]): void;
(msg: string, ...args: any[]): void;
}
export interface Logger {
child(bindings: Record<string, any>, options?: any): Logger;
fatal: LogFn;
error: LogFn;
warn: LogFn;
info: LogFn;
debug: LogFn;
trace: LogFn;
silent: LogFn;
}