From fe1ada86e858354ef3629c08baa517fffc2081cf Mon Sep 17 00:00:00 2001 From: Jacob Foshee Date: Fri, 5 Jul 2019 12:12:55 -0500 Subject: [PATCH] docs: add missing return to example storage.service.ts (#31434) While JavaScript does support implicit returns, it seems TypeScript will not infer the function return type from the implicit return of the last statement (at least not in TS 3.4.3). So, when the `return` is missing from the `get` function the implicit type of the function is `void`. So for the `get` function to be usable it needs to an explicit return. PR Close #31434 --- .../dependency-injection-in-action/src/app/storage.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aio/content/examples/dependency-injection-in-action/src/app/storage.service.ts b/aio/content/examples/dependency-injection-in-action/src/app/storage.service.ts index f90bbe01bc..df59c4e08a 100644 --- a/aio/content/examples/dependency-injection-in-action/src/app/storage.service.ts +++ b/aio/content/examples/dependency-injection-in-action/src/app/storage.service.ts @@ -16,7 +16,7 @@ export class BrowserStorageService { constructor(@Inject(BROWSER_STORAGE) public storage: Storage) {} get(key: string) { - this.storage.getItem(key); + return this.storage.getItem(key); } set(key: string, value: string) {