Skip to content

Commit 8a3c594

Browse files
docs(typedoc): Initial TypeDoc setup (#43)
* docs(typedoc): Typedoc setup * update typedoc version * change typedoc output directory to docs/ * remove generated docs Co-authored-by: Christian <[email protected]>
1 parent 6dbd713 commit 8a3c594

File tree

11 files changed

+168
-17
lines changed

11 files changed

+168
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Build
2+
docs/build/
23
build/
34
dist/
45

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ For a list of all matchers and extended documentation, please refer to the API d
6161
- [Jest Integration](docs/jest-tutorial.md)
6262
- [Mocha Integration](docs/mocha-tutorial.md)
6363

64+
## API Reference
65+
You can find the full API reference [here](/docs/pages/index.html)
66+
6467
## Contributors ✨
6568

6669
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"check": "yarn compile && yarn lint && yarn test --forbid-only",
1616
"compile": "tsc -p tsconfig.json",
1717
"lint": "tslint -c tslint.json \"!(build|dist)/**/*.ts\"",
18+
"pages": "typedoc",
1819
"test": "cross-env NODE_ENV=test TS_NODE_TRANSPILE_ONLY=true mocha"
1920
},
2021
"dependencies": {
@@ -30,6 +31,9 @@
3031
"sinon": "^14.0.0",
3132
"ts-node": "^10.9.1",
3233
"tslint": "^6.1.3",
34+
"typedoc": "^0.23.9",
35+
"typedoc-plugin-merge-modules": "^4.0.1",
36+
"typedoc-theme-hierarchy": "^3.0.0",
3337
"typescript": "^4.7.4"
3438
},
3539
"packageManager": "[email protected]"

src/lib/Assertion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { UnsupportedOperationError } from "./errors/UnsupportedOperationError";
55
import { isJSObject, isKeyOf } from "./helpers/guards";
66
import { TypeFactory } from "./helpers/TypeFactories";
77

8-
interface ExecuteOptions {
8+
export interface ExecuteOptions {
99
/**
1010
* The condition for when the assertion should pass. The negation of this
1111
* condition is also used for the `.not` case of the assertion
@@ -311,7 +311,7 @@ export class Assertion<T> {
311311
* an assertion instance for that specific type. The new assertion is built
312312
* from a factory that should extend from the base {@link Assertion} class.
313313
*
314-
* We provide some basic factories in {@code TypeFactories}. If you need some
314+
* We provide some basic factories in `TypeFactories`. If you need some
315315
* other factory for a custom assertion for instance, you can easily create
316316
* one from a Factory reference and a predicate.
317317
*

src/lib/FunctionAssertion.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TypeFactory } from "./helpers/TypeFactories";
66

77
export type AnyFunction = (...args: any[]) => any;
88

9-
interface Class<T> extends Function {
9+
export interface Class<T> extends Function {
1010
prototype: T;
1111
}
1212

@@ -51,7 +51,7 @@ export class FunctionAssertion<T extends AnyFunction> extends Assertion<T> {
5151
}
5252

5353
/**
54-
* Check if the function throws an {@link Error}. If the `ErrorType` is passed,
54+
* Check if the function throws an `Error`. If the `ErrorType` is passed,
5555
* it also checks if the error is an instance of the specific type.
5656
*
5757
* @example
@@ -66,7 +66,7 @@ export class FunctionAssertion<T extends AnyFunction> extends Assertion<T> {
6666
* ```
6767
*
6868
* @param ErrorType optional error type constructor to check the thrown error
69-
* against. If is not provided, it defaults to {@link Error}
69+
* against. If is not provided, it defaults to `Error`
7070
* @returns a new {@link ErrorAssertion} to assert over the error
7171
*/
7272
public toThrowError(): ErrorAssertion<Error>;

src/lib/NumberAssertion.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { AssertionError } from "assert";
33
import { Assertion } from "./Assertion";
44
import { isHighInclusiveOptions, isInclusiveOptions, isLowInclusiveOptions } from "./helpers/guards";
55

6-
interface BaseBetweenOptions {
6+
export interface BaseBetweenOptions {
77
range: [number, number];
88
}
99

10-
interface CloseToOptions {
10+
export interface CloseToOptions {
1111
value: number;
1212
withOffset: number;
1313
}
@@ -105,7 +105,7 @@ export class NumberAssertion extends Assertion<number> {
105105

106106
/**
107107
* Check if the number is finite. That is, when the number is not a
108-
* JavaScript's {@link Infinity} value. Keep in mind that this includes
108+
* JavaScript's `Infinity` value. Keep in mind that this includes
109109
* positive and negative infinity.
110110
*
111111
* @returns the assertion instance
@@ -129,7 +129,7 @@ export class NumberAssertion extends Assertion<number> {
129129

130130
/**
131131
* Check if the number is `NaN`. That is only when the number is JavaScript's
132-
* {@link NaN} value.
132+
* `NaN` value.
133133
*
134134
* @returns the assertion instance
135135
*/
@@ -200,7 +200,7 @@ export class NumberAssertion extends Assertion<number> {
200200
* bounds are exclusive, but the options allow to set the high, low, or both
201201
* limits as inclusive
202202
*
203-
* @param options an object of type {@link Between Options} where the `range`
203+
* @param options an object of type {@link BetweenOptions} where the `range`
204204
* property defines the bounds, so it's always required. Use
205205
* `inclusive: true` to make both limits inclusive. Or you can
206206
* selectively make low or high limits inclusive using

src/lib/ObjectAssertion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Assertion } from "./Assertion";
55

66
export type JSObject = Record<keyof any, unknown>;
77

8-
type Entry<T, K = keyof T> = K extends keyof T
8+
export type Entry<T, K = keyof T> = K extends keyof T
99
? [K, T[K]]
1010
: never;
1111

src/lib/expect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { JSObject, ObjectAssertion } from "./ObjectAssertion";
1010
import { PromiseAssertion } from "./PromiseAssertion";
1111
import { StringAssertion } from "./StringAssertion";
1212

13-
type PromiseType<T> = T extends Promise<infer X> ? X : never;
13+
export type PromiseType<T> = T extends Promise<infer X> ? X : never;
1414

15-
type ArrayType<T> = T extends Array<infer X> ? X : never;
15+
export type ArrayType<T> = T extends Array<infer X> ? X : never;
1616

1717
export function expect<T extends boolean>(actual: T): BooleanAssertion;
1818
export function expect<T extends number>(actual: T): NumberAssertion;

src/lib/helpers/TypeFactories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import { StringAssertion } from "../StringAssertion";
99

1010
import { isJSObject } from "./guards";
1111

12-
type AssertionFactory<S, A extends Assertion<S>> = new(actual: S) => A;
12+
export type AssertionFactory<S, A extends Assertion<S>> = new(actual: S) => A;
1313

1414
export interface TypeFactory<S, A extends Assertion<S>> {
1515
Factory: AssertionFactory<S, A>;
1616
predicate(value: unknown): value is S;
1717
typeName: string;
1818
}
1919

20-
interface StaticTypeFactories {
20+
export interface StaticTypeFactories {
2121
Boolean: TypeFactory<boolean, BooleanAssertion>;
2222
Date: TypeFactory<Date, DateAssertion>;
2323
Function: TypeFactory<AnyFunction, FunctionAssertion<AnyFunction>>;

typedoc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"cleanOutputDir": false,
3+
"entryPoints": ["src/lib"],
4+
"entryPointStrategy": "expand",
5+
"githubPages": true,
6+
"includeVersion": true,
7+
"mergeModulesMergeMode": "project",
8+
"mergeModulesRenameDefaults": true,
9+
"name": "assertive-ts",
10+
"out": "docs/build",
11+
"plugin": [
12+
"typedoc-theme-hierarchy",
13+
"typedoc-plugin-merge-modules"
14+
],
15+
"readme": "none",
16+
"theme": "hierarchy",
17+
"visibilityFilters": {
18+
"@alpha": false,
19+
"@beta": false,
20+
"external": false,
21+
"inherited": true,
22+
"private": false,
23+
"protected": false
24+
}
25+
}

0 commit comments

Comments
 (0)