Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added @txikijs/types #391

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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é <s@saghul.net>",
"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