I'm getting a typescript compiler error in the new library

Hi

i’m getting a typescript compiler error.
library : “@auth0/auth0-react”: “^2.0.0”

my code snippet where i’m setting up the auth0 sdk

  return (
    <Auth0Provider
      domain={process.env.NX_AUTH0_DOMAIN as string}
      clientId={process.env.NX_AUTH0_CLIENT_ID as string}
      authorizationParams={{
        redirect_uri: 'http://localhost:3000',
      }}
      onRedirectCallback={onRedirectCallback}
    >
      <JWTAuthAuthProvider>{children}</JWTAuthAuthProvider>
    </Auth0Provider>
  );
webpack compiled successfully (7ed53e852f0485dd)
ERROR in ./node_modules/@auth0/auth0-react/src/auth0-provider.tsx:160:53
TS2345: Argument of type 'unknown' is not assignable to parameter of type 'Error | { error: string; error_description?: string | undefined; } | ProgressEvent<EventTarget>'.
    158 |         dispatch({ type: 'INITIALISED', user });
    159 |       } catch (error) {
  > 160 |         dispatch({ type: 'ERROR', error: loginError(error) });
        |                                                     ^^^^^
    161 |       }
    162 |     })();
    163 |   }, [client, onRedirectCallback, skipRedirectCallback]);

ERROR in ./node_modules/@auth0/auth0-react/src/auth0-provider.tsx:180:53
TS2345: Argument of type 'unknown' is not assignable to parameter of type 'Error | { error: string; error_description?: string | undefined; } | ProgressEvent<EventTarget>'.
    178 |         await client.loginWithPopup(options, config);
    179 |       } catch (error) {
  > 180 |         dispatch({ type: 'ERROR', error: loginError(error) });
        |                                                     ^^^^^
    181 |         return;
    182 |       }
    183 |       const user = await client.getUser();

ERROR in ./node_modules/@auth0/auth0-react/src/auth0-provider.tsx:206:26
TS2345: Argument of type 'unknown' is not assignable to parameter of type 'Error | { error: string; error_description?: string | undefined; } | ProgressEvent<EventTarget>'.
    204 |         token = await client.getTokenSilently(opts);
    205 |       } catch (error) {
  > 206 |         throw tokenError(error);
        |                          ^^^^^
    207 |       } finally {
    208 |         dispatch({
    209 |           type: 'GET_ACCESS_TOKEN_COMPLETE',

ERROR in ./node_modules/@auth0/auth0-react/src/auth0-provider.tsx:227:26
TS2345: Argument of type 'unknown' is not assignable to parameter of type 'Error | { error: string; error_description?: string | undefined; } | ProgressEvent<EventTarget>'.
    225 |         token = await client.getTokenWithPopup(opts, config);
    226 |       } catch (error) {
  > 227 |         throw tokenError(error);
        |                          ^^^^^
    228 |       } finally {
    229 |         dispatch({
    230 |           type: 'GET_ACCESS_TOKEN_COMPLETE',

ERROR in ./node_modules/@auth0/auth0-react/src/auth0-provider.tsx:249:26
TS2345: Argument of type 'unknown' is not assignable to parameter of type 'Error | { error: string; error_description?: string | undefined; } | ProgressEvent<EventTarget>'.
    247 |         return await client.handleRedirectCallback(url);
    248 |       } catch (error) {
  > 249 |         throw tokenError(error);
        |                          ^^^^^
    250 |       } finally {
    251 |         dispatch({
    252 |           type: 'HANDLE_REDIRECT_COMPLETE',

Found 5 errors in 32759 ms.
2 Likes

Hey there!

In order to handle that most effectively can I ask you to raise it as a GitHub issue in the repo there so we can discuss it with the SDK maintainers directly? Once you have a link to the issue make sure to share it here so we can ping them. Thank you!