auth0 / auth0-spa-js

Auth0 authentication for Single Page Applications (SPA) with PKCE
MIT License
891 stars 351 forks source link

Implicit return in auth0-spa-js/src/cache /cache-manager.ts when TS "noImplicitReturns" is set to true #1280

Open denniscalazans opened 2 weeks ago

denniscalazans commented 2 weeks ago

Checklist

Description

private async getCacheKeys(): Promise<string[] | undefined> { if (this.keyManifest) { return (await this.keyManifest.get())?.keys; } else if (this.cache.allKeys) { return this.cache.allKeys(); } }

Reproduction

Install Auth0 library

✘ [ERROR] TS7030: Not all code paths return a value. [plugin angular-compiler]

    ../../node_modules/@auth0/auth0-spa-js/src/cache/cache-manager.ts:156:32:
      156 │   private async getCacheKeys(): Promise<string[] | undefined> {
          ╵                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Additional context

No response

auth0-spa-js version

2.1.3

Which framework are you using (React, Angular, Vue...)?

Angular

Framework version

17

Which browsers have you tested in?

Other

nandan-bhat commented 1 week ago

Hello @denniscalazans ,

I am not seeing the error you mentioned when I use auth0-spa-js@2.1.3 along with angular@17.3.0. Can you share your package.json here ?

Additionally, could you provide a code snippet demonstrating how you are using auth0-spa-js@2.1.3 ?. This would be helpful.

sanvisser commented 1 day ago

I'm having the same problem. We've implemented our own ICache, and configured that in Auth0.config.cache. That seems to cause it, reverting back and using the default 'memory' or 'localstorage' option does not cause this error to occur.

sanvisser commented 1 day ago

I've set "noImplicitReturns": false in our own tsconfig.json to fix this but that is less than ideal