Skip to content

Typescript compilation error #811

Open
@steaks

Description

@steaks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions