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

expect-type

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expect-type - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [0.7.0](https://github.com/mmkal/ts/compare/expect-type@0.6.0...expect-type@0.7.0) (2020-05-04)
### Features
* instance ([07b8621](https://github.com/mmkal/ts/commit/07b8621276a02f2ed1ff4d9446d0b8d6ba82ed5f))
# [0.6.0](https://github.com/mmkal/ts/compare/expect-type@0.5.5...expect-type@0.6.0) (2020-05-04)

@@ -8,0 +19,0 @@

3

dist/__tests__/index.test.js

@@ -77,2 +77,5 @@ "use strict";

});
test('Class instance types', () => {
__1.expectTypeOf(Date).instance.toHaveProperty('toISOString');
});
test('Promise resolution types can be checked with `.resolves`', () => {

@@ -79,0 +82,0 @@ const asyncFunc = async () => 123;

@@ -40,2 +40,3 @@ export declare type Not<T extends boolean> = T extends true ? false : true;

constructorParameters: ExpectTypeOf<ConstructorParams<Actual>, B>;
instance: Actual extends new (...args: any[]) => infer I ? ExpectTypeOf<I, B> : never;
returns: Actual extends (...args: any[]) => infer R ? ExpectTypeOf<R, B> : never;

@@ -42,0 +43,0 @@ resolves: Actual extends PromiseLike<infer R> ? ExpectTypeOf<R, B> : never;

@@ -18,3 +18,11 @@ "use strict";

exports.expectTypeOf = (actual) => {
const nonFunctionProperties = ['parameters', 'returns', 'resolves', 'not', 'items', 'constructorParameters'];
const nonFunctionProperties = [
'parameters',
'returns',
'resolves',
'not',
'items',
'constructorParameters',
'instance',
];
const obj = {

@@ -21,0 +29,0 @@ toBeAny: fn,

4

package.json
{
"name": "expect-type",
"version": "0.6.0",
"version": "0.7.0",
"repository": "https://github.com/mmkal/ts",

@@ -21,3 +21,3 @@ "homepage": "https://github.com/mmkal/ts/tree/master/packages/expect-type#readme",

],
"gitHead": "cc73488b05d18d73c7483746aead473db1179c56"
"gitHead": "a391629152a361f8d3a724f74d9719b3924e0421"
}

@@ -170,2 +170,8 @@ # expect-type

Class instance types:
```typescript
expectTypeOf(Date).instance.toHaveProperty('toISOString')
```
Promise resolution types can be checked with `.resolves`:

@@ -172,0 +178,0 @@

@@ -94,2 +94,6 @@ import {expectTypeOf} from '..'

test('Class instance types', () => {
expectTypeOf(Date).instance.toHaveProperty('toISOString')
})
test('Promise resolution types can be checked with `.resolves`', () => {

@@ -96,0 +100,0 @@ const asyncFunc = async () => 123

@@ -60,2 +60,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

constructorParameters: ExpectTypeOf<ConstructorParams<Actual>, B>
instance: Actual extends new (...args: any[]) => infer I ? ExpectTypeOf<I, B> : never
returns: Actual extends (...args: any[]) => infer R ? ExpectTypeOf<R, B> : never

@@ -81,3 +82,11 @@ resolves: Actual extends PromiseLike<infer R> ? ExpectTypeOf<R, B> : never

export const expectTypeOf = <Actual>(actual?: Actual): ExpectTypeOf<Actual, true> => {
const nonFunctionProperties = ['parameters', 'returns', 'resolves', 'not', 'items', 'constructorParameters'] as const
const nonFunctionProperties = [
'parameters',
'returns',
'resolves',
'not',
'items',
'constructorParameters',
'instance',
] as const
type Keys = keyof ExpectTypeOf<any, any>

@@ -84,0 +93,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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