expect-type
Advanced tools
Comparing version 0.4.5 to 0.4.6
@@ -6,2 +6,11 @@ # Change Log | ||
## [0.4.6](https://github.com/mmkal/ts/compare/expect-type@0.4.5...expect-type@0.4.6) (2020-03-30) | ||
**Note:** Version bump only for package expect-type | ||
## [0.4.5](https://github.com/mmkal/ts/compare/expect-type@0.4.4...expect-type@0.4.5) (2020-03-24) | ||
@@ -8,0 +17,0 @@ |
@@ -48,8 +48,4 @@ "use strict"; | ||
const obj = { a: 1, b: '' }; | ||
__1.expectTypeOf(obj) | ||
.property('a') | ||
.toEqualTypeOf(1); | ||
__1.expectTypeOf(obj) | ||
.property('b') | ||
.toEqualTypeOf(); | ||
__1.expectTypeOf(obj).property('a').toEqualTypeOf(1); | ||
__1.expectTypeOf(obj).property('b').toEqualTypeOf(); | ||
}); | ||
@@ -64,11 +60,5 @@ test('Assert on function parameters (using `.parameter(n)` or `.parameters`) and return values (using `.return`)', () => { | ||
__1.expectTypeOf(f).returns.toEqualTypeOf([1, 2, 3]); | ||
__1.expectTypeOf(f) | ||
.parameter(0) | ||
.not.toEqualTypeOf('1'); | ||
__1.expectTypeOf(f) | ||
.parameter(0) | ||
.toEqualTypeOf(1); | ||
__1.expectTypeOf(1) | ||
.parameter(0) | ||
.toBeNever(); | ||
__1.expectTypeOf(f).parameter(0).not.toEqualTypeOf('1'); | ||
__1.expectTypeOf(f).parameter(0).toEqualTypeOf(1); | ||
__1.expectTypeOf(1).parameter(0).toBeNever(); | ||
const twoArgFunc = (a, b) => ({ a, b }); | ||
@@ -75,0 +65,0 @@ __1.expectTypeOf(twoArgFunc).parameters.toEqualTypeOf(); |
@@ -33,3 +33,3 @@ export declare type Not<T extends boolean> = T extends true ? false : true; | ||
toEqualTypeOf: <Expected>(expected?: Expected, ...MISMATCH: MismatchArgs<Equal<Actual, Expected>, B>) => true; | ||
toBeCallableWith: B extends true ? ((...args: Params<Actual>) => true) : never; | ||
toBeCallableWith: B extends true ? (...args: Params<Actual>) => true : never; | ||
property<K extends keyof Actual>(key: K): ExpectTypeOf<Actual[K], B>; | ||
@@ -36,0 +36,0 @@ parameter<K extends keyof Params<Actual>>(number: K): ExpectTypeOf<Params<Actual>[K], B>; |
{ | ||
"name": "expect-type", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"repository": "https://github.com/mmkal/ts", | ||
@@ -16,3 +16,10 @@ "homepage": "https://github.com/mmkal/ts/tree/master/packages/expect-type#readme", | ||
}, | ||
"gitHead": "bdd108689be3bbae84a5a147a3ff174e641947aa" | ||
"keywords": [ | ||
"typescript", | ||
"validation", | ||
"inference", | ||
"types", | ||
"runtime" | ||
], | ||
"gitHead": "9a94949431744ea0ef0e7b7014c555fc9577755b" | ||
} |
@@ -9,3 +9,3 @@ # expect-type | ||
<!-- codegen:start {preset: markdownFromJsdoc, source: src/index.ts, export: expectTypeOf} --> | ||
#### [expectTypeOf](./src/index.ts#L67) | ||
#### [expectTypeOf](https://github.com/mmkal/ts/tree/9a94949/packages/expect-type/src/index.ts#L67) | ||
@@ -113,8 +113,4 @@ Similar to Jest's `expect`, but with type-awareness. Gives you access to a number of type-matchers that let you make assertions about the form of a reference or generic type parameter. | ||
expectTypeOf(obj) | ||
.property('a') | ||
.toEqualTypeOf(1) | ||
expectTypeOf(obj) | ||
.property('b') | ||
.toEqualTypeOf<string>() | ||
expectTypeOf(obj).property('a').toEqualTypeOf(1) | ||
expectTypeOf(obj).property('b').toEqualTypeOf<string>() | ||
``` | ||
@@ -134,11 +130,5 @@ | ||
expectTypeOf(f).returns.toEqualTypeOf([1, 2, 3]) | ||
expectTypeOf(f) | ||
.parameter(0) | ||
.not.toEqualTypeOf('1') | ||
expectTypeOf(f) | ||
.parameter(0) | ||
.toEqualTypeOf(1) | ||
expectTypeOf(1) | ||
.parameter(0) | ||
.toBeNever() | ||
expectTypeOf(f).parameter(0).not.toEqualTypeOf('1') | ||
expectTypeOf(f).parameter(0).toEqualTypeOf(1) | ||
expectTypeOf(1).parameter(0).toBeNever() | ||
@@ -145,0 +135,0 @@ const twoArgFunc = (a: number, b: string) => ({a, b}) |
@@ -56,8 +56,4 @@ import {expectTypeOf} from '..' | ||
expectTypeOf(obj) | ||
.property('a') | ||
.toEqualTypeOf(1) | ||
expectTypeOf(obj) | ||
.property('b') | ||
.toEqualTypeOf<string>() | ||
expectTypeOf(obj).property('a').toEqualTypeOf(1) | ||
expectTypeOf(obj).property('b').toEqualTypeOf<string>() | ||
}) | ||
@@ -75,11 +71,5 @@ | ||
expectTypeOf(f).returns.toEqualTypeOf([1, 2, 3]) | ||
expectTypeOf(f) | ||
.parameter(0) | ||
.not.toEqualTypeOf('1') | ||
expectTypeOf(f) | ||
.parameter(0) | ||
.toEqualTypeOf(1) | ||
expectTypeOf(1) | ||
.parameter(0) | ||
.toBeNever() | ||
expectTypeOf(f).parameter(0).not.toEqualTypeOf('1') | ||
expectTypeOf(f).parameter(0).toEqualTypeOf(1) | ||
expectTypeOf(1).parameter(0).toBeNever() | ||
@@ -86,0 +76,0 @@ const twoArgFunc = (a: number, b: string) => ({a, b}) |
@@ -44,3 +44,3 @@ export type Not<T extends boolean> = T extends true ? false : true | ||
toEqualTypeOf: <Expected>(expected?: Expected, ...MISMATCH: MismatchArgs<Equal<Actual, Expected>, B>) => true | ||
toBeCallableWith: B extends true ? ((...args: Params<Actual>) => true) : never | ||
toBeCallableWith: B extends true ? (...args: Params<Actual>) => true : never | ||
property<K extends keyof Actual>(key: K): ExpectTypeOf<Actual[K], B> | ||
@@ -72,3 +72,3 @@ parameter<K extends keyof Params<Actual>>(number: K): ExpectTypeOf<Params<Actual>[K], B> | ||
type FunctionsDict = Record<Exclude<Keys, (typeof nonFunctionProperties)[number]>, any> | ||
type FunctionsDict = Record<Exclude<Keys, typeof nonFunctionProperties[number]>, any> | ||
const obj: FunctionsDict = { | ||
@@ -75,0 +75,0 @@ toBeAny: fn, |
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
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
205325
3184
180