New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simplytyped

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplytyped - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

5

dist/src/types/predicates.d.ts

@@ -19,3 +19,6 @@ import { False, ReallyTrue, And, Xor, Not } from './conditionals';

export declare type IsStringFunction<T extends string> = And<IsString<T>, IsNever<T>>;
export declare type IsBoolean<T> = And<And<And<Not<IsStringFunction<Diff<Keys<T>, BooleanPrototypeKeys>>>, Not<IsNever<Keys<T>>>>, Not<HasKey<T, string>>>, IsNever<Diff<Keys<T>, BooleanPrototypeKeys>>>;
export declare type IsBoolean<T> = And<And<And<Not<IsStringFunction<Diff<Keys<T>, BooleanPrototypeKeys>>>, // filter out annoying prototype keys ie: 'toString' & () => boolean
Not<IsNever<Keys<T>>>>, // Make sure isn't a function because function types have no prototype keys, making first check fail
Not<HasKey<T, string>>>, // Make sure isn't any, by checking that all strings are in the prototype
IsNever<Diff<Keys<T>, BooleanPrototypeKeys>>>;
export declare type IsObject<T> = And<And<And<And<Not<IsArray<T>>, Not<IsNumber<T>>>, Not<IsString<T>>>, Not<IsBoolean<T>>>, Not<IsFunction<T>>>;

1

dist/src/types/utils.d.ts

@@ -10,1 +10,2 @@ import { ObjectType } from "./objects";

export declare type NotNullable<T> = T & {};
export declare type Unknown = {} | null | undefined;
{
"name": "simplytyped",
"version": "0.2.3",
"version": "0.2.4",
"description": "yet another Typescript type library for advanced types",

@@ -41,3 +41,3 @@ "main": "dist/src/index",

"tslint": "^5.8.0",
"typescript": "^2.8.0-dev.20180315"
"typescript": "^2.8.0-dev.20180320"
},

@@ -44,0 +44,0 @@ "pre-push": [

@@ -50,3 +50,3 @@ # SimplyTyped

[Nullable](#nullable) - [NotNullable](#notnullable) - [NoInfer](#noinfer)
[Nullable](#nullable) - [NotNullable](#notnullable) - [NoInfer](#noinfer) - [Unknown](#unknown)

@@ -310,2 +310,15 @@ **[Schema Validation](#schema-validation)**

### Unknown
A type that has no properties and cannot be passed into functions.
This is particularly useful on the boundaries of an app where you may not know the type of a variable.
For instance `JSON.parse` could return an `Unknown` and would require validation and / or a type assertion to make it a useful type.
```ts
declare let x: Unknown;
x = 'hi'; // valid operation
function doStuff(a: number) {}
doStuff(x); // invalid operation
x.thing // invalid operation
x() // invalid operation
```
## Tuples

@@ -312,0 +325,0 @@ A tuple can be defined in two ways: `[number, string]` which as of Typescript 2.7 has an enforced length type parameter: `[number, string]['length'] === 2` or using this library's `Tuple<any>` which can be extended with any length of tuple: `function doStuff<T extends Tuple<any>>(x: T) {}`.

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