auth0 / auth0-react

Auth0 SDK for React Single Page Applications (SPA)
MIT License
891 stars 259 forks source link

Typescript compilation error #811

Open steaks opened 3 weeks ago

steaks commented 3 weeks ago

Checklist

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