Comparing version 5.0.4 to 5.1.0
@@ -18,14 +18,14 @@ import { toType, toValidableType, validateType, fromType } from './utils'; | ||
config: import("./types").VueTypesConfig; | ||
readonly any: VueTypeValidableDef<any>; | ||
readonly func: VueTypeValidableDef<(...args: any[]) => any> & { | ||
readonly any: VueTypeValidableDef<any, import("./types").ValidatorFunction<any>>; | ||
readonly func: VueTypeValidableDef<(...args: any[]) => any, import("./types").ValidatorFunction<(...args: any[]) => any>> & { | ||
default: (...args: any[]) => any; | ||
}; | ||
readonly bool: VueTypeValidableDef<boolean>; | ||
readonly string: VueTypeValidableDef<string> & { | ||
readonly bool: VueTypeValidableDef<boolean, import("./types").ValidatorFunction<boolean>>; | ||
readonly string: VueTypeValidableDef<string, import("./types").ValidatorFunction<string>> & { | ||
default: string; | ||
}; | ||
readonly number: VueTypeValidableDef<number> & { | ||
readonly number: VueTypeValidableDef<number, import("./types").ValidatorFunction<number>> & { | ||
default: number; | ||
}; | ||
readonly array: VueTypeValidableDef<unknown[]> & { | ||
readonly array: VueTypeValidableDef<unknown[], import("./types").ValidatorFunction<unknown[]>> & { | ||
default: () => unknown[]; | ||
@@ -35,3 +35,5 @@ }; | ||
[key: string]: any; | ||
}> & { | ||
}, import("./types").ValidatorFunction<{ | ||
[key: string]: any; | ||
}>> & { | ||
default: () => { | ||
@@ -56,3 +58,3 @@ [key: string]: any; | ||
validate<T_1, U>(value: T_1, type: U): boolean; | ||
toType<T_2 = unknown>(name: string, obj: PropOptions<T_2, T_2>, validable?: boolean): VueTypeDef<T_2> | VueTypeValidableDef<T_2>; | ||
toType<T_2 = unknown>(name: string, obj: PropOptions<T_2, T_2>, validable?: boolean): VueTypeDef<T_2> | VueTypeValidableDef<T_2, import("./types").ValidatorFunction<T_2>>; | ||
}; | ||
@@ -65,14 +67,14 @@ }; | ||
config: import("./types").VueTypesConfig; | ||
readonly any: VueTypeValidableDef<any>; | ||
readonly func: VueTypeValidableDef<(...args: any[]) => any> & { | ||
readonly any: VueTypeValidableDef<any, import("./types").ValidatorFunction<any>>; | ||
readonly func: VueTypeValidableDef<(...args: any[]) => any, import("./types").ValidatorFunction<(...args: any[]) => any>> & { | ||
default: (...args: any[]) => any; | ||
}; | ||
readonly bool: VueTypeValidableDef<boolean>; | ||
readonly string: VueTypeValidableDef<string> & { | ||
readonly bool: VueTypeValidableDef<boolean, import("./types").ValidatorFunction<boolean>>; | ||
readonly string: VueTypeValidableDef<string, import("./types").ValidatorFunction<string>> & { | ||
default: string; | ||
}; | ||
readonly number: VueTypeValidableDef<number> & { | ||
readonly number: VueTypeValidableDef<number, import("./types").ValidatorFunction<number>> & { | ||
default: number; | ||
}; | ||
readonly array: VueTypeValidableDef<unknown[]> & { | ||
readonly array: VueTypeValidableDef<unknown[], import("./types").ValidatorFunction<unknown[]>> & { | ||
default: () => unknown[]; | ||
@@ -82,3 +84,5 @@ }; | ||
[key: string]: any; | ||
}> & { | ||
}, import("./types").ValidatorFunction<{ | ||
[key: string]: any; | ||
}>> & { | ||
default: () => { | ||
@@ -103,3 +107,3 @@ [key: string]: any; | ||
validate<T_1, U>(value: T_1, type: U): boolean; | ||
toType<T_2 = unknown>(name: string, obj: PropOptions<T_2, T_2>, validable?: boolean): VueTypeDef<T_2> | VueTypeValidableDef<T_2>; | ||
toType<T_2 = unknown>(name: string, obj: PropOptions<T_2, T_2>, validable?: boolean): VueTypeDef<T_2> | VueTypeValidableDef<T_2, import("./types").ValidatorFunction<T_2>>; | ||
}; | ||
@@ -106,0 +110,0 @@ }; |
@@ -76,6 +76,5 @@ export type Prop<T = any> = | ||
export interface VueTypeValidableDef<T = unknown> extends VueTypeBaseDef<T> { | ||
readonly validate: ( | ||
fn: ValidatorFunction<T | unknown>, | ||
) => this & { validator: ValidatorFunction<T | unknown> } | ||
export interface VueTypeValidableDef<T = unknown, V = ValidatorFunction<T>> | ||
extends VueTypeBaseDef<T> { | ||
readonly validate: (fn: V) => this & { validator: V } | ||
} | ||
@@ -82,0 +81,0 @@ |
@@ -55,3 +55,3 @@ import { VueTypeDef, VueTypeValidableDef, VueProp, InferType, PropOptions, VueTypesConfig } from './types'; | ||
*/ | ||
export declare const isVueTypeDef: <T>(value: any, name?: string) => value is VueTypeDef<T> | VueTypeValidableDef<T>; | ||
export declare const isVueTypeDef: <T>(value: any, name?: string) => value is VueTypeDef<T> | VueTypeValidableDef<T, import("./types").ValidatorFunction<T>>; | ||
/** | ||
@@ -104,3 +104,3 @@ * Checks if the passed-in value is a Vue prop definition object or a VueTypes type | ||
*/ | ||
export declare function toValidableType<T = any>(name: string, obj: PropOptions<T>): VueTypeValidableDef<T>; | ||
export declare function toValidableType<T = any>(name: string, obj: PropOptions<T>): VueTypeValidableDef<T, import("./types").ValidatorFunction<T>>; | ||
/** | ||
@@ -107,0 +107,0 @@ * Clones an object preserving all of it's own keys. |
import { PropOptions } from '../types'; | ||
export declare const any: <T = any>() => import("../types").VueTypeValidableDef<T>; | ||
export declare const func: <T extends (...args: any[]) => any>() => import("../types").VueTypeValidableDef<T>; | ||
export declare const bool: () => import("../types").VueTypeValidableDef<boolean>; | ||
export declare const string: <T extends string = string>() => import("../types").VueTypeValidableDef<T>; | ||
export declare const number: <T extends number = number>() => import("../types").VueTypeValidableDef<T>; | ||
export declare const array: <T>() => import("../types").VueTypeValidableDef<T[]>; | ||
export declare const any: <T = any>() => import("../types").VueTypeValidableDef<T, import("../types").ValidatorFunction<T>>; | ||
export declare const func: <T extends (...args: any[]) => any>() => import("../types").VueTypeValidableDef<T, import("../types").ValidatorFunction<T>>; | ||
export declare const bool: () => import("../types").VueTypeValidableDef<boolean, import("../types").ValidatorFunction<boolean>>; | ||
export declare const string: <T extends string = string>() => import("../types").VueTypeValidableDef<T, import("../types").ValidatorFunction<T>>; | ||
export declare const number: <T extends number = number>() => import("../types").VueTypeValidableDef<T, import("../types").ValidatorFunction<T>>; | ||
export declare const array: <T>() => import("../types").VueTypeValidableDef<T[], import("../types").ValidatorFunction<T[]>>; | ||
export declare const object: <T extends { | ||
[key: string]: any; | ||
}>() => import("../types").VueTypeValidableDef<T>; | ||
}>() => import("../types").VueTypeValidableDef<T, import("../types").ValidatorFunction<T>>; | ||
export declare const integer: <T extends number = number>() => import("../types").VueTypeDef<T>; | ||
export declare const symbol: () => import("../types").VueTypeDef<symbol>; | ||
export declare const nullable: () => PropOptions<null, null>; |
{ | ||
"name": "vue-types", | ||
"version": "5.0.4", | ||
"version": "5.1.0", | ||
"description": "Prop types utility for Vue", | ||
@@ -37,18 +37,2 @@ "author": "Marco Solazzi", | ||
], | ||
"scripts": { | ||
"prepublishOnly": "run-s lint test build", | ||
"build": "run-s 'clean:*' copy 'build:**'", | ||
"clean:dist": "del dist", | ||
"clean:shim": "del \"shim/*.*\" \"!shim/package.json\"", | ||
"copy": "cpy --flat src/*.d.ts dist", | ||
"build:ts": "microbundle --tsconfig=./tsconfig.build.json --format=modern,es", | ||
"build:cjs": "microbundle --tsconfig=./tsconfig.build.json -i src/index.cjs.ts -o dist/vue-types.cjs --no-pkg-main --format=cjs", | ||
"build:umd": "cross-env NODE_ENV=production microbundle --tsconfig=./tsconfig.build.json --format=umd", | ||
"build:shim:ts": "microbundle --tsconfig=./tsconfig.build.json -i src/shim.ts -o shim/index.js --format=modern,es --no-sourcemap", | ||
"build:shim:cjs": "microbundle --tsconfig=./tsconfig.build.json -i src/shim.cjs.ts -o shim/index.cjs.js --no-pkg-main --format=cjs --no-sourcemap", | ||
"build:shim:umd": "cross-env NODE_ENV=production microbundle --tsconfig=./tsconfig.build.json -i src/shim.cjs.ts -o shim/index.js --format=umd --no-sourcemap", | ||
"test": "vitest run --coverage", | ||
"test:watch": "vitest watch", | ||
"lint": "eslint '{src,__tests__,.}/**/*.{ts,js,cjs}'" | ||
}, | ||
"keywords": [ | ||
@@ -76,3 +60,2 @@ "vue", | ||
"microbundle": "0.15.1", | ||
"npm-run-all": "4.1.5", | ||
"typescript": "5.0.4" | ||
@@ -87,3 +70,18 @@ }, | ||
} | ||
}, | ||
"scripts": { | ||
"build": "pnpm run \"/^clean:.*/\" && pnpm run copy && pnpm run \"/^build:.*/\"", | ||
"clean:dist": "del dist", | ||
"clean:shim": "del \"shim/*.*\" \"!shim/package.json\"", | ||
"copy": "cpy --flat src/*.d.ts dist", | ||
"build:ts": "microbundle --tsconfig=./tsconfig.build.json --format=modern,es", | ||
"build:cjs": "microbundle --tsconfig=./tsconfig.build.json -i src/index.cjs.ts -o dist/vue-types.cjs --no-pkg-main --format=cjs", | ||
"build:umd": "cross-env NODE_ENV=production microbundle --tsconfig=./tsconfig.build.json --format=umd", | ||
"build:shim:ts": "microbundle --tsconfig=./tsconfig.build.json -i src/shim.ts -o shim/index.js --format=modern,es --no-sourcemap", | ||
"build:shim:cjs": "microbundle --tsconfig=./tsconfig.build.json -i src/shim.cjs.ts -o shim/index.cjs.js --no-pkg-main --format=cjs --no-sourcemap", | ||
"build:shim:umd": "cross-env NODE_ENV=production microbundle --tsconfig=./tsconfig.build.json -i src/shim.cjs.ts -o shim/index.js --format=umd --no-sourcemap", | ||
"test": "vitest run --coverage", | ||
"test:watch": "vitest watch", | ||
"lint": "eslint '{src,__tests__,.}/**/*.{ts,js,cjs}'" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
297670
10
37
746