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

Update to [email protected] #319

Merged
merged 4 commits into from
Jan 13, 2022
Merged

Update to [email protected] #319

merged 4 commits into from
Jan 13, 2022

Conversation

adamjmcgrath
Copy link
Contributor

@adamjmcgrath adamjmcgrath commented Jan 12, 2022

Description

Upgrade SPA JS to https://github.com/auth0/auth0-spa-js/releases/tag/v1.19.3 and add some overloads for the detailed token response option.

Also upgraded jest and typescript while I was debugging some jest/ts issues

References

auth0-angular equivalent auth0/auth0-angular#231
https://github.com/auth0/auth0-spa-js/releases

@adamjmcgrath adamjmcgrath added the review:small Small review label Jan 12, 2022
@adamjmcgrath adamjmcgrath requested a review from a team as a code owner January 12, 2022 15:38
id_token: '456',
expires_in: 2,
};
(clientMock.getTokenSilently as jest.Mock).mockResolvedValue(tokenResponse);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -2,13 +2,14 @@ const pkg = require('./package.json');

module.exports = {
clearMocks: true,
coveragePathIgnorePatterns: ['/__tests__/'],
coveragePathIgnorePatterns: ['/__tests__/', 'index.tsx'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Istanbul isn't showing coverage for export only files at the moment gotwarlost/istanbul#930

@@ -304,7 +302,8 @@ const Auth0Provider = (opts: Auth0ProviderOptions): JSX.Element => {
);

const getAccessTokenSilently = useCallback(
async (opts?: GetTokenSilentlyOptions): Promise<string> => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async (opts?: GetTokenSilentlyOptions): Promise<any> => {
Copy link
Contributor Author

@adamjmcgrath adamjmcgrath Jan 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding the any, this is an issue with overloads - the typing still works for the user with intellisense, there's just no type safety for the return type in this function.

image

image

@@ -28,7 +28,7 @@ const withAuth0 = <P extends WithAuth0Props>(
): ComponentType<Omit<P, keyof WithAuth0Props>> => (props): JSX.Element => (
<Auth0Context.Consumer>
{(auth: Auth0ContextInterface): JSX.Element => (
<Component auth0={auth} {...(props as P)} />
<Component {...(props as P)} auth0={auth} />
Copy link
Contributor Author

@adamjmcgrath adamjmcgrath Jan 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wrapped component expects auth0: Auth0Client, so the new version of TS doesn't like that it can be overridden (which would be a bug)

@@ -14,7 +14,8 @@
"noFallthroughCasesInSwitch": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
"useUnknownInCatchVariables": false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -12,7 +12,6 @@
"gatsby-plugin-manifest": "^2.4.9",
"gatsby-plugin-offline": "^3.2.7",
"gatsby-plugin-react-helmet": "^3.3.2",
"gatsby-plugin-sharp": "^2.6.9",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as this was not needed and had a downstream dependency that was failing the build imagemin/imagemin-mozjpeg#70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review:small Small review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants