Compare commits

...

3 Commits

Author SHA1 Message Date
fefb06613f
publish
All checks were successful
Build and publish / publish (push) Successful in 11s
2023-08-26 15:00:24 -07:00
17e457ed2b
0.2.1 2023-08-26 15:00:03 -07:00
64a6cac8f5
add types for async functions 2023-08-26 14:59:55 -07:00
4 changed files with 10 additions and 6 deletions

View File

@ -3,9 +3,9 @@ name: Build and publish
on:
workflow_dispatch: { }
# push:
# branches:
# - master
push:
branches:
- master
jobs:
publish:

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@templates/typescript-types",
"version": "0.2.0",
"version": "0.2.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@templates/typescript-types",
"version": "0.2.0",
"version": "0.2.1",
"license": "ISC",
"devDependencies": {
"typescript": "^5.1.3"

View File

@ -1,6 +1,6 @@
{
"name": "@js/types",
"version": "0.2.0",
"version": "0.2.1",
"description": "Collection of generic TypeScript type definitions for various utility purposes",
"main": "src/index.d.ts",
"types": "src/index.d.ts",

4
src/functions.d.ts vendored
View File

@ -1,6 +1,10 @@
export type Func<T extends any = any> = (...args: any[]) => T;
export type AsyncFunc<T extends any = any> = (...args: any[]) => PromiseLike<T>;
export type AsyncResult<T extends AsyncFunc> = Awaited<ReturnType<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;