generated from templates/typescript-types
more types
This commit is contained in:
parent
2eea0e09c4
commit
065a29f0cc
10
src/functions.d.ts
vendored
Normal file
10
src/functions.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
export type Func<T extends any = any> = (...args: any[]) => T;
|
||||
|
||||
export type Params<T extends Func> = T extends (...args: infer P) => any ? P : never;
|
||||
|
||||
export type FirstParam<T extends Func> = T extends (first: infer F, ...args: any[]) => any ? F : never;
|
||||
|
||||
export type NonFirstParams<T extends Func> = T extends (first: any, ...args: infer P) => any ? P : never;
|
||||
|
||||
export type WithoutFirstParam<T extends Func> = T extends (first: any, ...args: infer P) => infer R ? (...args: P) => R : never;
|
6
src/identifiers.d.ts
vendored
6
src/identifiers.d.ts
vendored
@ -1,6 +1,12 @@
|
||||
|
||||
/** An HTTP URL, e.g. `https://example.com/foo?bar=baz` */
|
||||
export type HttpURL = `http://${string}` | `https://${string}`;
|
||||
|
||||
/** An HTTP URL without the scheme specified, e.g. `//example.com/foo?bar=baz` */
|
||||
export type HttpURLSchemeless = `//${string}`;
|
||||
|
||||
/** An RFC 4122 Universally Unique Identifier string */
|
||||
export type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
||||
|
||||
/** A Snowflake unique identifier string */
|
||||
export type SnowflakeID = `${bigint}`;
|
||||
|
3
src/index.d.ts
vendored
3
src/index.d.ts
vendored
@ -1,4 +1,7 @@
|
||||
|
||||
export * from './functions';
|
||||
export * from './http';
|
||||
export * from './identifiers';
|
||||
export * from './locale';
|
||||
export * from './logger';
|
||||
export * from './time';
|
||||
|
3
src/locale.d.ts
vendored
Normal file
3
src/locale.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
/** A combined ISO 639-1 language code and ISO 3166-1 alpha-2 country code, like `en-US` */
|
||||
export type Locale = `${string}-${string}`;
|
21
src/time.d.ts
vendored
Normal file
21
src/time.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
/** A date string, formatted `YYYY-MM-DD` */
|
||||
export type ISODate = `${number}-${number}-${number}`;
|
||||
|
||||
/** A time string, formatted `HH:mm:ss.sss` */
|
||||
export type ISOTime = `${number}:${number}:${number}.${number}`;
|
||||
|
||||
/** */
|
||||
export type ISOZoneOffset = 'Z' | `${'+' | '-' | ''}${number}:${number}`;
|
||||
|
||||
/** */
|
||||
export type ISOTimestamp = `${ISODate}T${ISOTime}${ISOZoneOffset}`;
|
||||
|
||||
/** A time string, formatted `HH:mm` */
|
||||
export type TimeShort = `${number}:${number}`;
|
||||
|
||||
/** A date/time string, formatted `YYYY-MM-DD HH:mm` */
|
||||
export type LocalDateTime = `${ISODate} ${TimeShort}`;
|
||||
|
||||
/** A timezone identifier string, like `America/Los_Angeles` */
|
||||
export type Timezone = `${string}/${string}`;
|
Loading…
x
Reference in New Issue
Block a user