hirezio / auto-spies

Create automatic spies from classes
MIT License
181 stars 30 forks source link

Add conditional spy type by the return value [WIP] #4

Closed Bnaya closed 6 years ago

Bnaya commented 6 years ago

Use ts 2.8 conditional types to expose propper types for the spys

shairez commented 6 years ago

First of all, Thanks @Bnaya !

I've tested it and it looks great for promises and Observables, but we lost the regular spies now.

(If you run npm test you can see the error in line 30 on create-spy-from-class.spec.ts

Can you do more magic and make the tests pass please?

Thanks!

Bnaya commented 6 years ago

I've updated the code, now the tests passing. Note that until angular toolchain won't support 2.8 this PR is not very usefull

shairez commented 6 years ago

Thanks @Bnaya for the update ! Question - will it work with older versions of TypeScript? or will throw an error?

Bnaya commented 6 years ago

I didn't check it myself, i guess it will break older TS versions, as they don't know the new syntax. TS 2.8 support is scheduled for angular 6.1 https://github.com/angular/angular/issues/23092

shairez commented 6 years ago

Thanks again @Bnaya ! I merged it, added a few changes and bumped the version number

shairez commented 6 years ago

:tada: This PR is included in version 3.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: