schemaglobin
Advanced tools
Comparing version 3.3.6 to 3.3.7
@@ -68,2 +68,3 @@ { | ||
"prefer-template": 0, | ||
"@typescript-eslint/no-empty-function": 0, | ||
"@typescript-eslint/no-unused-vars": 0, | ||
@@ -70,0 +71,0 @@ "@typescript-eslint/ban-ts-ignore": 0 |
import { Schema, SchemaOptions, NullIfOptional } from "../types"; | ||
import { Invalid } from "../Invalid"; | ||
interface NumberOptions<T extends number = number, R extends boolean = false> extends SchemaOptions { | ||
readonly value?: T | null; | ||
readonly value?: number | null; | ||
readonly required?: R; | ||
@@ -21,3 +21,3 @@ readonly min?: number | null; | ||
readonly placeholder: string; | ||
readonly value: T | null; | ||
readonly value: number | null; | ||
readonly required: R; | ||
@@ -24,0 +24,0 @@ readonly min: number | null; |
import { Schema, SchemaOptions, EmptyIfOptional } from "../types"; | ||
import { Invalid } from "../Invalid"; | ||
interface StringOptions<T extends string = string, R extends boolean = false> extends SchemaOptions { | ||
readonly value?: T; | ||
readonly value?: string; | ||
readonly required?: R; | ||
@@ -38,3 +38,3 @@ readonly min?: number; | ||
readonly placeholder: string; | ||
readonly value: T; | ||
readonly value: string; | ||
readonly required: R; | ||
@@ -41,0 +41,0 @@ readonly min: number; |
{ | ||
"name": "schemaglobin", | ||
"description": "Validate user-entered data.", | ||
"version": "3.3.6", | ||
"version": "3.3.7", | ||
"repository": "https://github.com/dhoulb/schemaglobin", | ||
"author": "Dave Houlbrooke <dave@shax.com>", | ||
"license": "0BSD", | ||
"bump": "8e9c4fb5cd7fba71c7b9351a", | ||
"main": "dist/index.js", | ||
@@ -28,7 +29,7 @@ "types": "dist/index.d.ts", | ||
"@types/jest": "^25.1.1", | ||
"@typescript-eslint/eslint-plugin": "2.9.0", | ||
"@typescript-eslint/parser": "^2.9.0", | ||
"@typescript-eslint/eslint-plugin": "^2.22.0", | ||
"@typescript-eslint/parser": "^2.22.0", | ||
"eslint": "^6.7.1", | ||
"eslint-config-prettier": "^6.7.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-plugin-import": "^2.20.1", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
@@ -38,4 +39,4 @@ "jest": "^25.1.0", | ||
"ts-jest": "^25.0.0", | ||
"typescript": "^3.7.2" | ||
"typescript": "^3.8.3" | ||
} | ||
} |
@@ -6,3 +6,3 @@ # Schemaglobin: Validate unknown user input against schemas | ||
[![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) | ||
[![GitHub Actions](https://img.shields.io/github/workflow/status/dhoulb/schemaglobin/CI/master)](https://github.com/dhoulb/schemaglobin/actions) | ||
[![GitHub Actions](https://github.com/dhoulb/schemaglobin/workflows/CI/badge.svg?branch=master)](https://github.com/dhoulb/schemaglobin/actions) | ||
[![npm](https://img.shields.io/npm/dm/schemaglobin.svg)](https://www.npmjs.com/package/schemaglobin) | ||
@@ -9,0 +9,0 @@ |
@@ -10,3 +10,3 @@ import { Schema, SchemaOptions, NullIfOptional } from "../types"; | ||
interface NumberOptions<T extends number = number, R extends boolean = false> extends SchemaOptions { | ||
readonly value?: T | null; | ||
readonly value?: number | null; | ||
readonly required?: R; | ||
@@ -28,3 +28,3 @@ readonly min?: number | null; | ||
readonly placeholder: string; | ||
readonly value: T | null; | ||
readonly value: number | null; | ||
readonly required: R; | ||
@@ -31,0 +31,0 @@ readonly min: number | null; |
@@ -12,3 +12,3 @@ /* eslint-disable no-control-regex */ | ||
interface StringOptions<T extends string = string, R extends boolean = false> extends SchemaOptions { | ||
readonly value?: T; | ||
readonly value?: string; | ||
readonly required?: R; | ||
@@ -47,3 +47,3 @@ readonly min?: number; | ||
readonly placeholder: string; | ||
readonly value: T; | ||
readonly value: string; | ||
readonly required: R; | ||
@@ -50,0 +50,0 @@ readonly min: number; |
@@ -22,2 +22,7 @@ import { number, NumberSchema, Invalid } from "../../src"; | ||
const r8: number | null | Invalid = s8.validate(); | ||
// All three of these should be assignable because the Schema should have exact type `NumberSchema<1, false>`. | ||
// This is to fix and test for a bug where `NumberSchema<0, false>` was being inferred when `options.value = 0` was set. | ||
const s9: NumberSchema<1, false> = number({}); | ||
const s10: NumberSchema<1, false> = number({ value: 0 }); | ||
const s11: NumberSchema<1, false> = new NumberSchema({ value: 0 }); | ||
}); | ||
@@ -24,0 +29,0 @@ test("Constructs correctly", () => { |
@@ -26,2 +26,7 @@ import { string, StringSchema, Invalid } from "../../src"; | ||
const r8: string | Invalid = s8.validate(); | ||
// All three of these should be assignable because the Schema should have exact type `StringSchema<"abc", false>`. | ||
// This is to fix and test for a bug where `StringSchema<0, false>` was being inferred when `options.value = 0` was set. | ||
const s9: StringSchema<"abc", false> = string({}); | ||
const s10: StringSchema<"abc", false> = string({ value: "def" }); | ||
const s11: StringSchema<"abc", false> = new StringSchema({ value: "def" }); | ||
}); | ||
@@ -28,0 +33,0 @@ test("Constructs correctly", () => { |
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
224470
4810