Skip to content

Commit

Permalink
doc: added @txikijs/types
Browse files Browse the repository at this point in the history
Co-authored-by: Luca Lindhorst <[email protected]>
  • Loading branch information
lal12 and Luca Lindhorst committed Oct 10, 2023
1 parent ac449e4 commit 24b021b
Show file tree
Hide file tree
Showing 13 changed files with 517 additions and 420 deletions.
13 changes: 13 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @txikijs/types

To use the typings in your TS project, install it via `npm i @txikijs/types --save-dev`

Then either add `node_modules/@txikijs/types` to the `typeRoots` in your `tsconfig.json`:
```json
"typeRoots": {
"node_modules/@txikijs/types",
"node_modules/@types"
}
```

Or alternatively add `import type from '@txikijs/types';` somewhere in your code.
22 changes: 22 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@txikijs/types",
"version": "23.1.0",
"description": "",
"main": "",
"types": "types/index.d.ts",
"keywords": ["tjs","txiki","txikijs"],
"repository": {
"type": "git",
"url": "https://github.com/saghul/txiki.js.git",
"directory": "docs"
},
"bugs": {
"url": "https://github.com/saghul/txiki.js/issues"
},
"author": "Saúl Ibarra Corretgé <[email protected]>",
"license": "MIT",
"files": [
"types",
"README.md"
]
}
3 changes: 2 additions & 1 deletion docs/tsconfig.doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"entryPointStrategy": "expand",
"out": "api/",
"readme": "intro.md",
"disableSources": true
"disableSources": true,
"exclude":["types/index.d.ts"]
}
}
137 changes: 69 additions & 68 deletions docs/types/assert.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,81 +3,82 @@
*
* @module tjs:assert
*/
declare module 'tjs:assert'{
export interface IAssertionResult<T> {
pass: boolean;
actual: unknown;
expected: T;
description: string;
operator: string;
at?: string;
}

export interface IAssertionResult<T> {
pass: boolean;
actual: unknown;
expected: T;
description: string;
operator: string;
at?: string;
}
export interface ComparatorAssertionFunction {
<T>(actual: unknown, expected: T, description?: string): IAssertionResult<T>;
}

export interface ComparatorAssertionFunction {
<T>(actual: unknown, expected: T, description?: string): IAssertionResult<T>;
}
export interface BooleanAssertionFunction {
(actual: unknown, description?: string): IAssertionResult<boolean>;
}

export interface BooleanAssertionFunction {
(actual: unknown, description?: string): IAssertionResult<boolean>;
}
export type ErrorAssertionFunction = {
(
fn: Function,
expected: RegExp | Function,
description?: string
): IAssertionResult<string | Function>;
(fn: Function, description?: string): IAssertionResult<string>;
};

export type ErrorAssertionFunction = {
(
fn: Function,
expected: RegExp | Function,
description?: string
): IAssertionResult<string | Function>;
(fn: Function, description?: string): IAssertionResult<string>;
};
export interface MessageAssertionFunction {
(message?: string): IAssertionResult<string>;
}

export interface MessageAssertionFunction {
(message?: string): IAssertionResult<string>;
}
export interface IAssert {
equal: ComparatorAssertionFunction;

equals: ComparatorAssertionFunction;

eq: ComparatorAssertionFunction;

deepEqual: ComparatorAssertionFunction;

notEqual: ComparatorAssertionFunction;

notEquals: ComparatorAssertionFunction;

notEq: ComparatorAssertionFunction;

notDeepEqual: ComparatorAssertionFunction;

is: ComparatorAssertionFunction;

same: ComparatorAssertionFunction;

isNot: ComparatorAssertionFunction;

notSame: ComparatorAssertionFunction;

ok: BooleanAssertionFunction;

truthy: BooleanAssertionFunction;

notOk: BooleanAssertionFunction;

falsy: BooleanAssertionFunction;

fail: MessageAssertionFunction;

throws: ErrorAssertionFunction;
}

export interface IAssert {
equal: ComparatorAssertionFunction;

equals: ComparatorAssertionFunction;

eq: ComparatorAssertionFunction;

deepEqual: ComparatorAssertionFunction;

notEqual: ComparatorAssertionFunction;

notEquals: ComparatorAssertionFunction;

notEq: ComparatorAssertionFunction;

notDeepEqual: ComparatorAssertionFunction;

is: ComparatorAssertionFunction;

same: ComparatorAssertionFunction;

isNot: ComparatorAssertionFunction;

notSame: ComparatorAssertionFunction;

ok: BooleanAssertionFunction;

truthy: BooleanAssertionFunction;

notOk: BooleanAssertionFunction;

falsy: BooleanAssertionFunction;

fail: MessageAssertionFunction;

throws: ErrorAssertionFunction;
}
function factory(options?: IAssertOptions): IAssert;

declare function factory(options?: IAssertOptions): IAssert;
export const Assert: IAssert;

export declare const Assert: IAssert;
export interface IAssertOptions {
onResult: (result: IAssertionResult<unknown>) => void;
}

export interface IAssertOptions {
onResult: (result: IAssertionResult<unknown>) => void;
export default factory;
}

export default factory;
Loading

0 comments on commit 24b021b

Please sign in to comment.