Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
6 tasks done
denniscalazans opened this issue Jun 21, 2024 · 4 comments · May be fixed by #1285
Open
6 tasks done
Assignees
Labels
bug This points to a verified bug in the code

Comments

@denniscalazans
Copy link

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

  • npm i --save @auth0/auth0-spa-js

  • Make use of it

  • npm run build the angular project

✘ [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

@denniscalazans denniscalazans added the bug This points to a verified bug in the code label Jun 21, 2024
@denniscalazans denniscalazans changed the title Implicit return in auth0-spa-js/src/cache /cache-manager.ts Implicit return in auth0-spa-js/src/cache /cache-manager.ts when TS "noImplicitReturns" is set to true Jun 21, 2024
@nandan-bhat
Copy link

Hello @denniscalazans ,

I am not seeing the error you mentioned when I use [email protected] along with [email protected]. Can you share your package.json here ?

Additionally, could you provide a code snippet demonstrating how you are using [email protected] ?. This would be helpful.

@nandan-bhat nandan-bhat self-assigned this Jun 26, 2024
@sanvisser
Copy link

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
Copy link

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

@sanvisser sanvisser linked a pull request Jul 9, 2024 that will close this issue
3 tasks
@Ionaru
Copy link

Ionaru commented Jul 9, 2024

Was caused by a direct import from @auth0/auth0-spa-js/src/cache/shared instead of @auth0/auth0-spa-js in our repo.

The MaybePromise return type is not re-exported by @auth0/auth0-angular, so that might be why some people are running into this problem when implementing their own Cache. I think some editors will attempt to directly import that type from @auth0/auth0-spa-js/src/cache/shared when @auth0/auth0-spa-js is not in the package.json, because it is a dependency of @auth0/auth0-angular.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This points to a verified bug in the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants