auth0-react icon indicating copy to clipboard operation
auth0-react copied to clipboard

Typescript compilation error

Open steaks opened this issue 1 year ago • 0 comments

Checklist

  • [X] The issue can be reproduced in the auth0-react sample app (or N/A).
  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the API documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Description

My project uses Typescript 4.6.3. This library fails to compile with these errors.

node_modules/@auth0/auth0-react/src/utils.tsx:22:20 - error TS2339: Property 'error' does not exist on type 'object'.

22       typeof error.error === 'string'
                      ~~~~~

node_modules/@auth0/auth0-react/src/utils.tsx:26:22 - error TS2339: Property 'error_description' does not exist on type 'object'.

26         typeof error.error_description === 'string'
                        ~~~~~~~~~~~~~~~~~

node_modules/@auth0/auth0-react/src/utils.tsx:28:37 - error TS2339: Property 'error' does not exist on type 'object'.

28         return new OAuthError(error.error, error.error_description);
                                       ~~~~~

node_modules/@auth0/auth0-react/src/utils.tsx:28:50 - error TS2339: Property 'error_description' does not exist on type 'object'.

28         return new OAuthError(error.error, error.error_description);
                                                    ~~~~~~~~~~~~~~~~~

node_modules/@auth0/auth0-react/src/utils.tsx:30:35 - error TS2339: Property 'error' does not exist on type 'object'.

30       return new OAuthError(error.error);

Reproduction

  1. Clone auth0-react
  2. Change typescript version to 4.6.3 in package.json
  3. Change moduleResolution to node in tsconfig.json
  4. npm install
  5. npx tsc -b
  6. See errors
src/utils.tsx:22:20 - error TS2339: Property 'error' does not exist on type 'object'.

22       typeof error.error === 'string'
                      ~~~~~

src/utils.tsx:26:22 - error TS2339: Property 'error_description' does not exist on type 'object'.

26         typeof error.error_description === 'string'
                        ~~~~~~~~~~~~~~~~~

src/utils.tsx:28:37 - error TS2339: Property 'error' does not exist on type 'object'.

28         return new OAuthError(error.error, error.error_description);
                                       ~~~~~

src/utils.tsx:28:50 - error TS2339: Property 'error_description' does not exist on type 'object'.

28         return new OAuthError(error.error, error.error_description);
                                                    ~~~~~~~~~~~~~~~~~

src/utils.tsx:30:35 - error TS2339: Property 'error' does not exist on type 'object'.

30       return new OAuthError(error.error);
                                     ~~~~~


Found 5 errors.

Additional context

No response

auth0-react version

2.2.1

React version

17.0.2

Which browsers have you tested in?

Other

steaks avatar Oct 21 '24 02:10 steaks