Skip to content

Commit

Permalink
FIX: rules do not exist on type 'EnforceExtendMap' (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Sep 8, 2020
1 parent 2accb48 commit dca5b3b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/vest/src/spec/infra.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('General scenario tests', () => {

describe('TypeScript Typings', () => {
const declarationFiles = glob
.sync('src/**/*.d.ts', {
.sync('src/typings/*.d.ts', {
cwd: packagePath('vest'),
absolute: true,
ignore: '**/spec/*',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { IVestResult } from './vest';

declare function classNames(
res: Partial<IVestResult>,
classes?: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { EnforceExtendMap, IEnforceRules } from './vest';

interface ExtendedRules {
isAlphanumeric: (...args: any) => IEnforceRules;
isCreditCard: (...args: any) => IEnforceRules;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { IVestResult, DraftResult } from './vest';

declare function promisify(
validatorFn: (...args: any[]) => IVestResult
): Promise<DraftResult>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export type DraftResult = Omit<IVestResult, 'done'>;

type TestCB = () => void | Promise<string | void> | false;
type DraftResult = Omit<IVestResult, 'done'>;
type DoneCB = (res: DraftResult) => void;
type ExclusionArg = string | string[] | void;

interface IVestResult {
export type IVestResult = {
name: string;
errorCount: number;
warnCount: number;
Expand All @@ -28,7 +29,6 @@ interface IVestResult {
};
};
};

/**
* Returns whether the specified field has errors
*/
Expand Down Expand Up @@ -95,13 +95,13 @@ interface IVestResult {
* Runs a callback when all tests of the specified field finished running
*/
done(fieldName: string, cb: DoneCB): void;
}
};

type EnforceExtendMap<T> = {
export type EnforceExtendMap<T> = {
[K in keyof T]: (...args: any[]) => IEnforceRules<T> & EnforceExtendMap<T>;
};

interface IEnforceRules<T = {}> {
export interface IEnforceRules<T = {}> {
equals: (expected: any) => IEnforceRules<T> & EnforceExtendMap<T>;
notEquls: (expected: any) => IEnforceRules<T> & EnforceExtendMap<T>;
numberEquals: (
Expand Down
2 changes: 1 addition & 1 deletion scripts/steps/copyDistFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function copyDistFiles(packageName) {
// And copy them over to the root folder
// This is good enough until I add a ts build
glob
.sync('src/**/*.d.ts', {
.sync('src/typings/*.d.ts', {
cwd: packagePath(packageName),
absolute: true,
ignore: '**/spec/*',
Expand Down

0 comments on commit dca5b3b

Please sign in to comment.