Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

superstruct

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superstruct - npm Package Compare versions

Comparing version 0.16.2 to 0.16.3

8

lib/structs/types.d.ts

@@ -37,7 +37,7 @@ import { Infer, Struct } from '../struct';

*/
export declare function enums<T extends number>(values: readonly T[]): Struct<T, {
[K in T[][number]]: K;
export declare function enums<U extends number, T extends U[]>(values: T): Struct<T[number], {
[K in T[number]]: K;
}>;
export declare function enums<T extends string>(values: readonly T[]): Struct<T, {
[K in T[][number]]: K;
export declare function enums<U extends string, T extends U[]>(values: T): Struct<T[number], {
[K in T[number]]: K;
}>;

@@ -44,0 +44,0 @@ /**

@@ -5,3 +5,3 @@ {

"description": "A simple and composable way to validate data in JavaScript (and TypeScript).",
"version": "0.16.2",
"version": "0.16.3",
"license": "MIT",

@@ -57,3 +57,3 @@ "repository": "git://github.com/ianstormtaylor/superstruct.git",

"rollup-plugin-ts": "^3.0.1",
"typescript": "^4.1.2"
"typescript": "^4.8.3"
},

@@ -60,0 +60,0 @@ "scripts": {

@@ -86,3 +86,3 @@ /**

*/
type IsUnion<T, U extends T> = (T extends any ? (U extends T ? false : true) : false) extends false ? never : T;
type IsUnion<T, U extends T = T> = (T extends any ? (U extends T ? false : true) : false) extends false ? never : T;
/**

@@ -174,5 +174,5 @@ * A schema for object structs.

*/
type InferStructTuple<Tuple extends AnyStruct[], Length extends number> = Length extends Length ? number extends Length ? Tuple : _InferTuple<Tuple, Length, [
type InferStructTuple<Tuple extends AnyStruct[], Length extends number = Tuple["length"]> = Length extends Length ? number extends Length ? Tuple : _InferTuple<Tuple, Length, [
]> : never;
type _InferTuple<Tuple extends AnyStruct[], Length extends number, Accumulated extends unknown[], Index extends number> = Index extends Length ? Accumulated : _InferTuple<Tuple, Length, [
type _InferTuple<Tuple extends AnyStruct[], Length extends number, Accumulated extends unknown[], Index extends number = Accumulated["length"]> = Index extends Length ? Accumulated : _InferTuple<Tuple, Length, [
...Accumulated,

@@ -186,3 +186,3 @@ Infer<Tuple[Index]>

*/
declare class Struct<T, S> {
declare class Struct<T = unknown, S = unknown> {
readonly TYPE: T;

@@ -295,3 +295,3 @@ type: string;

*/
type Coercer<T> = (value: T, context: Context) => unknown;
type Coercer<T = unknown> = (value: T, context: Context) => unknown;
/**

@@ -403,7 +403,7 @@ * A `Validator` takes an unknown value and validates it.

*/
declare function enums<T extends number>(values: readonly T[]): Struct<T, {
[K in T[][number]]: K;
declare function enums<U extends number, T extends U[]>(values: T): Struct<T[number], {
[K in T[number]]: K;
}>;
declare function enums<T extends string>(values: readonly T[]): Struct<T, {
[K in T[][number]]: K;
declare function enums<U extends string, T extends U[]>(values: T): Struct<T[number], {
[K in T[number]]: K;
}>;

@@ -410,0 +410,0 @@ /**

@@ -86,3 +86,3 @@ /**

*/
type IsUnion<T, U extends T> = (T extends any ? (U extends T ? false : true) : false) extends false ? never : T;
type IsUnion<T, U extends T = T> = (T extends any ? (U extends T ? false : true) : false) extends false ? never : T;
/**

@@ -174,5 +174,5 @@ * A schema for object structs.

*/
type InferStructTuple<Tuple extends AnyStruct[], Length extends number> = Length extends Length ? number extends Length ? Tuple : _InferTuple<Tuple, Length, [
type InferStructTuple<Tuple extends AnyStruct[], Length extends number = Tuple["length"]> = Length extends Length ? number extends Length ? Tuple : _InferTuple<Tuple, Length, [
]> : never;
type _InferTuple<Tuple extends AnyStruct[], Length extends number, Accumulated extends unknown[], Index extends number> = Index extends Length ? Accumulated : _InferTuple<Tuple, Length, [
type _InferTuple<Tuple extends AnyStruct[], Length extends number, Accumulated extends unknown[], Index extends number = Accumulated["length"]> = Index extends Length ? Accumulated : _InferTuple<Tuple, Length, [
...Accumulated,

@@ -186,3 +186,3 @@ Infer<Tuple[Index]>

*/
declare class Struct<T, S> {
declare class Struct<T = unknown, S = unknown> {
readonly TYPE: T;

@@ -295,3 +295,3 @@ type: string;

*/
type Coercer<T> = (value: T, context: Context) => unknown;
type Coercer<T = unknown> = (value: T, context: Context) => unknown;
/**

@@ -403,7 +403,7 @@ * A `Validator` takes an unknown value and validates it.

*/
declare function enums<T extends number>(values: readonly T[]): Struct<T, {
[K in T[][number]]: K;
declare function enums<U extends number, T extends U[]>(values: T): Struct<T[number], {
[K in T[number]]: K;
}>;
declare function enums<T extends string>(values: readonly T[]): Struct<T, {
[K in T[][number]]: K;
declare function enums<U extends string, T extends U[]>(values: T): Struct<T[number], {
[K in T[number]]: K;
}>;

@@ -410,0 +410,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc