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

json-schema-to-ts

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-schema-to-ts - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0-beta.0

jest.config.js

11

lib/index.d.ts

@@ -7,15 +7,4 @@ import { M } from "ts-algebra";

export { FromSchemaOptions, FromSchemaDefaultOptions } from "./definitions";
/**
* Unwidened V7 JSON schema (e.g. defined with the `as const` statement)
*/
export declare type JSONSchema7 = $JSONSchema7 | Readonly<$JSONSchema7>;
/**
* Unwidened JSON schema (e.g. defined with the `as const` statement)
*/
export declare type JSONSchema = JSONSchema7;
/**
* Given a JSON schema defined with the `as const` statement, infers the type of valid instances
*
* @param S JSON schema
*/
export declare type FromSchema<S extends JSONSchema7, O extends FromSchemaOptions = FromSchemaDefaultOptions> = M.$Resolve<ParseSchema<S extends O.Object ? Writable<S> : S, {

@@ -22,0 +11,0 @@ parseNotKeyword: O["parseNotKeyword"] extends boolean ? O["parseNotKeyword"] : FromSchemaDefaultOptions["parseNotKeyword"];

@@ -1,8 +0,1 @@

/**
* Return `true` if `A` and `B` extend `true`, `false` otherwise
*
* @param A Type
* @param B Type
* @return Boolean
*/
export declare type And<A, B> = A extends true ? B extends true ? true : false : false;

@@ -1,17 +0,4 @@

/**
* Returns `true` if type `A` extends type `B`, `false` if not
*
* @param A Type
* @param B Type
* @return Boolean
*/
export declare type DoesExtend<A, B> = A extends B ? true : false;
declare type ArrayKeys = keyof [];
/**
* Returns `true` if type is object, `false` if not (excludes arrays)
*
* @param T Type
* @return Boolean
*/
export declare type IsObject<T> = T extends object ? ArrayKeys extends Extract<keyof T, ArrayKeys> ? false : true : false;
export {};

@@ -1,8 +0,1 @@

/**
* Returns `true` if object `O` has a property key in `K` (union), `false` if not
*
* @param O Object
* @param K Union of property keys
* @return Type
*/
export declare type HasKeyIn<O, K> = Extract<keyof O, K> extends never ? false : true;
import { IsObject } from "./extends";
/**
* Merge two types `A` and `B`:
* - Returns `B` if `A` and `B` are not both objects
* - Merge `A` and `B` properties if both are objects
* - Merging is not recursive: Properties of `B` erase properties of `A`
*
* @param A Type
* @param B Type
* @return Type
*/
export declare type Merge<A, B> = IsObject<A> extends true ? IsObject<B> extends true ? {
[K in keyof A | keyof B]: K extends keyof B ? B[K] : K extends keyof A ? A[K] : never;
} : B : B;
import { O } from "ts-toolbelt";
/**
* Recursively sets all type properties as readonly
*
* @param T Type
* @return Type
*/
export declare type Readonly<T> = T extends O.Object ? {
readonly [P in keyof T]: Readonly<T[P]>;
} : T;

@@ -1,9 +0,3 @@

/**
* Recursively sets all type properties as writable (non-readonly)
*
* @param T Type
* @return Type
*/
export declare type Writable<T> = {
-readonly [P in keyof T]: Writable<T[P]>;
};

12

package.json
{
"name": "json-schema-to-ts",
"version": "2.0.1",
"version": "2.1.0-beta.0",
"description": "Infer typescript types from your JSON schemas!",
"main": "lib/index.d.ts",
"main": "lib/index.js",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"release": "bash scripts/release.bash",
"test": "tsc --noEmit && jest --verbose",
"type": "tsc --noEmit"
"test": "yarn test:type && yarn test:unit",
"test:type": "tsc --noEmit",
"test:unit": "jest --verbose",
"build": "tsc -p tsconfig.build.json"
},

@@ -11,0 +15,0 @@ "dependencies": {

import dts from "rollup-plugin-dts";
import { rollupImportMapPlugin } from "rollup-plugin-import-map";
import { basename } from 'path';
import { dependencies } from "./package.json"
import { basename } from "path";
import { dependencies } from "./package.json";
// as it currently stands, all skypack plugins for rollup do not support scoped imports (e.g. @types/*)

@@ -11,3 +12,3 @@ // nor do they support a ?dts query string suffix to the url, which is necessary for deno

for (const [dep, ver] of Object.entries(dependencies))
importMap[basename(dep)] = `https://cdn.skypack.dev/${dep}@${ver}?dts`;
importMap[basename(dep)] = `https://cdn.skypack.dev/${dep}@${ver}?dts`;

@@ -19,6 +20,8 @@ const config = [

plugins: [
rollupImportMapPlugin([{
imports: importMap,
}]),
dts(),
rollupImportMapPlugin([
{
imports: importMap,
},
]),
dts(),
],

@@ -29,2 +32,1 @@ },

export default config;
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