Skip to content

Commit 93fa596

Browse files
fixed huge declaration file (#28)
1 parent 9ee6c6e commit 93fa596

File tree

11 files changed

+58
-25
lines changed

11 files changed

+58
-25
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
1212

1313
:pencil: - chore
1414

15+
## 1.4.1
16+
- :beetle: fixed huge declaration file
17+
1518
## 1.4.0
1619
- :rocket: dropped chai dependency in favor of own `expect` implementation
1720

index.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

package-lock.json

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "@qavajs/validation",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "Lib that transform plain english definition to validation functions",
5-
"main": "index.js",
5+
"main": "./lib/index.js",
66
"scripts": {
77
"build": "tsc",
88
"test": "vitest --coverage run"
@@ -20,14 +20,14 @@
2020
"Alexandr Legchilov"
2121
],
2222
"license": "MIT",
23-
"types": "./index.d.ts",
23+
"types": "./lib/index.d.ts",
2424
"bugs": {
2525
"url": "https://github.com/qavajs/validation/issues"
2626
},
2727
"homepage": "https://github.com/qavajs/validation#readme",
2828
"devDependencies": {
29-
"@types/node": "^24.6.0",
30-
"typescript": "^5.9.2",
29+
"@types/node": "^24.6.2",
30+
"typescript": "^5.9.3",
3131
"@vitest/coverage-v8": "^3.2.4",
3232
"vitest": "^3.2.4"
3333
},

src/expect.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class SoftAssertionError extends AssertionError {
88
name: string = 'SoftAssertionError';
99
}
1010

11-
type MatcherContext<Target> = {
11+
export type MatcherContext<Target> = {
1212
received: Target;
1313
isNot: boolean;
1414
isSoft: boolean;
@@ -17,7 +17,7 @@ type MatcherContext<Target> = {
1717
asString(value: any): string;
1818
};
1919

20-
type MatcherResult = {
20+
export type MatcherResult = {
2121
pass: boolean;
2222
message: string;
2323
};

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { getValidation, getPollValidation, verify, validationRegexp, poll, expect } from './verify';
2+
export { AssertionError, SoftAssertionError } from './expect';

src/matchers.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,37 @@
1-
import { expect as base } from './expect';
1+
import { expect as base, type MatcherResult, type MatcherContext } from './expect';
22
import Ajv from 'ajv';
33

4-
export const expect = base.extend({
4+
export type BaseMatchers = {
5+
toSimpleEqual(this: MatcherContext<any>, expected: any): MatcherResult;
6+
toEqual(this: MatcherContext<any>, expected: any): MatcherResult;
7+
toCaseInsensitiveEqual(this: MatcherContext<any>, expected: string): MatcherResult;
8+
toBe(this: MatcherContext<any>, expected: any): MatcherResult;
9+
toBeGreaterThan(this: MatcherContext<any>, expected: number): MatcherResult;
10+
toBeGreaterThanOrEqual(this: MatcherContext<any>, expected: number): MatcherResult;
11+
toBeLessThan(this: MatcherContext<any>, expected: number): MatcherResult;
12+
toBeLessThanOrEqual(this: MatcherContext<any>, expected: number): MatcherResult;
13+
toBeNaN(this: MatcherContext<any>): MatcherResult;
14+
toBeNull(this: MatcherContext<any>): MatcherResult;
15+
toBeUndefined(this: MatcherContext<any>): MatcherResult;
16+
toBeTruthy(this: MatcherContext<any>): MatcherResult;
17+
toContain(this: MatcherContext<any>, expected: any): MatcherResult;
18+
toDeepEqual(this: MatcherContext<any>, expected: any): MatcherResult;
19+
toStrictEqual(this: MatcherContext<any>, expected: any): MatcherResult;
20+
toHaveLength(this: MatcherContext<any>, expected: number): MatcherResult;
21+
toHaveProperty(this: MatcherContext<any>, key: string, value?: any): MatcherResult;
22+
toMatch(this: MatcherContext<any>, expected: string | RegExp): MatcherResult;
23+
toThrow(this: MatcherContext<() => any>, expected?: string | RegExp): MatcherResult;
24+
toSatisfy(this: MatcherContext<any>, expected: (received: any) => boolean): MatcherResult;
25+
toResolveWith(this: MatcherContext<Promise<any>>, expected: any): Promise<MatcherResult>;
26+
toRejectWith(this: MatcherContext<Promise<any>>, expected: string): Promise<MatcherResult>;
27+
toPass(this: MatcherContext<() => any>): Promise<MatcherResult>;
28+
toMatchSchema(this: MatcherContext<any>, schema: object): MatcherResult;
29+
toHaveMembers(this: MatcherContext<any[]>, expected: any[]): MatcherResult;
30+
toIncludeMembers(this: MatcherContext<any[]>, expected: any[]): MatcherResult;
31+
toHaveType(this: MatcherContext<any>, expected: string): MatcherResult;
32+
}
33+
34+
export const expect = base.extend<BaseMatchers>({
535
toSimpleEqual(expected: any) {
636
const pass = this.received == expected;
737
const message = this.formatMessage(this.received, expected, 'to equal', this.isNot);

test/expect.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect } from '../src/matchers';
1+
import { expect } from '../src';
22
import { test, describe, expect as vitestExpect } from 'vitest';
33

44
describe('Basic assertions', () => {

test/poll.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test, expect } from 'vitest';
2-
import { getPollValidation, poll } from '../src/verify';
2+
import { getPollValidation, poll } from '../src';
33

44
function asyncActualValueString() {
55
let index = 0;

0 commit comments

Comments
 (0)