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
This commit is contained in:
parent
17d5266cdb
commit
fe1ada86e8
|
@ -16,7 +16,7 @@ export class BrowserStorageService {
|
||||||
constructor(@Inject(BROWSER_STORAGE) public storage: Storage) {}
|
constructor(@Inject(BROWSER_STORAGE) public storage: Storage) {}
|
||||||
|
|
||||||
get(key: string) {
|
get(key: string) {
|
||||||
this.storage.getItem(key);
|
return this.storage.getItem(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
set(key: string, value: string) {
|
set(key: string, value: string) {
|
||||||
|
|
Loading…
Reference in New Issue