Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs(toh): add return types #1983

Closed
wants to merge 2 commits into from

Conversation

Foxandxss
Copy link
Member

So this PR adds return types for ToH. Since we print the code on the screen (as snippets in our guide), it is nice to have those return types on the signature so the readers can see what a method returns.

@Foxandxss
Copy link
Member Author

@wardbell so I like the end result, perhaps the ": void" ones are a bit verbose tho.

In one case, we show an empty method, so I had to put it with : void and then when we put the data in it, I swapped that with the real Promise<Hero[]>.

What do you think?

@chalin
Copy link
Contributor

chalin commented Jul 28, 2016

I totally agree with your reasoning: having explicit return types helps readers figure out what is going on. And this brings the code a bit more aligned with the Dart version. I think the : void is appropriate (and not too verbose).

On the other hand, I find we have too many auxiliary "documentation only" source files, so I'd avoid creating toh-4/ts/app/hero.service.2.ts and just use hero.service.1.ts enhanced with an appropriate type annotation.

cc @kwalrath

@chalin
Copy link
Contributor

chalin commented Aug 3, 2016

In follow-up to my last comment, this is the TS equivalent of what I did on the Dart side of the docs:

  /*
  // #docregion getHeroes-stub
  getHeroes(): Hero[] { return []; }
  // #enddocregion getHeroes-stub
  */

@wardbell wardbell closed this in e9a41ba Aug 18, 2016
@wardbell wardbell deleted the toh-return-types branch August 18, 2016 05:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants