Skip to content

Commit a5e0903

Browse files
committed
docs: types
Signed-off-by: Lexus Drumgold <[email protected]>
1 parent c1341c1 commit a5e0903

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Create [Node.js errors][1]
1717
- [Use](#use)
1818
- [API](#api)
1919
- [Types](#types)
20+
- [Enums](#enums)
21+
- [Type Defintions](#type-definitions)
2022
- [Contribute](#contribute)
2123

2224
## What is this?
@@ -64,7 +66,17 @@ yarn add @flex-development/errnode@flex-development/errnode
6466

6567
## Types
6668

67-
This package is fully typed with [TypeScript][7].
69+
This package is fully typed with [TypeScript][7]. It exports the following definitions:
70+
71+
### Enums
72+
73+
- [`ErrorCode`](src/enums/error-code.ts)
74+
75+
### Type Definitions
76+
77+
- [`NodeError`](src/types/node-error.ts)
78+
- [`NodeErrorConstructor`](src/types/node-error-constructor.ts)
79+
- [`MessageFn`](src/types/fn-message.ts)
6880

6981
## Contribute
7082

src/types/fn-message.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
*/
55

66
/**
7-
* Formats an error message.
7+
* Creates an error message.
88
*
9-
* @template Args - Function parameters
9+
* @template Args - Function parameters type
1010
*
1111
* @param {Args} args - Function parameters
12-
* @return {string} Formatted error message
12+
* @return {string} Error message
1313
*/
1414
type MessageFn<Args extends any[] = any[]> = (...args: Args) => string
1515

src/types/node-error-constructor.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ type NodeErrorConstructor<
2121
M extends MessageFn | string = string,
2222
T extends B['prototype'] = B['prototype']
2323
> = Overwrite<B, B> & {
24-
readonly prototype: NodeError<T>
25-
26-
new (...args: M extends MessageFn ? Parameters<M> : any[]): NodeError<T>
2724
(...args: M extends MessageFn ? Parameters<M> : any[]): NodeError<T>
25+
new (...args: M extends MessageFn ? Parameters<M> : any[]): NodeError<T>
26+
readonly prototype: NodeError<T>
2827
}
2928

3029
export type { NodeErrorConstructor as default }

0 commit comments

Comments
 (0)