Skip to content

Support .returns() with static value#130

Open
parisholley wants to merge 3 commits intoflorinn:masterfrom
parisholley:returns
Open

Support .returns() with static value#130
parisholley wants to merge 3 commits intoflorinn:masterfrom
parisholley:returns

Conversation

@parisholley
Copy link

@parisholley parisholley commented Aug 27, 2019

It is annoying to always use a function because of the following use case:

interface Wee {
  value?: string
}

let test:Wee = {value: 'foobar'};

if (test) {
  mock.setup(m => m.do()).returns(() => test);
}

typescript will complain because test can be "undefined"

@tobysmith568
Copy link

Hi @parisholley

The author of Typemoq, @florinn, hasn't been active on Github for a couple of years now. In order to keep Typemoq progressing I have created a fork over at https://github.com/typemoq/typemoq-continued where I would like us as a community to continue development while Florinn is absent.

If you would like, I invite you to create a PR over on that repo where this feature can then be merged in. The new repo is on NPM under typemoq-continued.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants