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

Add Custom ApolloClient Type to client.tsx #12

Closed
wants to merge 4 commits into from

Conversation

deep-foundation-sweepai[bot]
Copy link

Description

This PR introduces a custom ApolloClient type that extends the ApolloClient from the '@apollo/client' package and includes additional properties: 'path', 'ssl', and 'jwt_token'. This custom type is then used in the 'client.tsx' file instead of the original ApolloClient.

Summary of Changes

  • Imported ApolloClient from '@apollo/client' as BaseApolloClient in 'client.tsx'.
  • Created and exported a new type called ApolloClient that extends BaseApolloClient and adds a 'path' property of type string, an 'ssl' property of type boolean, and a 'jwt_token' property of type string.
  • Replaced the ApolloClient in the 'IApolloClient' interface with the new custom ApolloClient type.
  • Replaced the ApolloClient in the return type of the 'generateApolloClient' function with the new custom ApolloClient type.
  • Replaced the 'new ApolloClient' in the 'generateApolloClient' function with 'new BaseApolloClient'.

These changes ensure that the ApolloClient used in the application includes the additional properties and functionalities required by the user.

Fixes #8.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/custom-apollo-client-type

🎉 Latest improvements to Sweep:


💡 To get Sweep to edit this pull request, you can:

  • Leave a comment below to get Sweep to edit the entire PR
  • Leave a comment in the code will only modify the file
  • Edit the original issue to get Sweep to recreate the PR from scratch

@deep-foundation-sweepai deep-foundation-sweepai bot added the sweep Sweep your software chores label Sep 12, 2023
@deep-foundation-sweepai
Copy link
Author

GitHub actions yielded the following error.

The command that failed is npm run package:build.

Here are the relevant error lines from the logs:

##[error]client.tsx(46,18): error TS2430: Interface 'IApolloClient<T>' incorrectly extends interface 'ApolloClient<any> & { path: string; ssl: boolean; jwt_token: string; }'.
Type 'IApolloClient<T>' is not assignable to type '{ path: string; ssl: boolean; jwt_token: string; }'.
Property 'path' is optional in type 'IApolloClient<T>' but required in type '{ path: string; ssl: boolean; jwt_token: string; }'.
##[error]client.tsx(139,3): error TS2322: Type 'IApolloClient<any>' is not assignable to type 'ApolloClient'.
Type 'IApolloClient<any>' is not assignable to type '{ path: string; ssl: boolean; jwt_token: string; }'.
Property 'path' is optional in type 'IApolloClient<any>' but required in type '{ path: string; ssl: boolean; jwt_token: string; }'.
##[error]Process completed with exit code 2.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@deep-foundation-sweepai
Copy link
Author

GitHub actions yielded the following error.

##[group]Run npm run build
npm ERR! Missing script: "build"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run
npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2023-09-12T12_02_06_892Z-debug-0.log
##[error]Process completed with exit code 1.

The command that failed is npm run build.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@FreePhoenix888
Copy link
Member

FreePhoenix888 commented Sep 12, 2023

Sweepai: Interface 'IApolloClient' incorrectly extends interface 'ApolloClient & { path: string; ssl: boolean; jwt_token: string; } is throwed because you do not pass types parameter

@FreePhoenix888
Copy link
Member

Sweepai: pass type parameter to BaseApolloClient

@FreePhoenix888
Copy link
Member

Sweeep: pass the type parameter to BaseApolloClient

2 similar comments
@FreePhoenix888
Copy link
Member

Sweeep: pass the type parameter to BaseApolloClient

@FreePhoenix888
Copy link
Member

Sweeep: pass the type parameter to BaseApolloClient

@@ -37,7 +43,7 @@ export function generateHeaders(options: IApolloClientGeneratorOptions) {
return headers;
}

export interface IApolloClient<T> extends ApolloClient<T> {
export interface IApolloClient<T> extends ApolloClient {
Copy link
Member

@FreePhoenix888 FreePhoenix888 Sep 13, 2023

Choose a reason for hiding this comment

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

Sweep: pass the type parameter to BaseApolloClient

Copy link
Author

Choose a reason for hiding this comment

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

No changes made. Please add more details so I know what to change.

@@ -37,7 +43,7 @@ export function generateHeaders(options: IApolloClientGeneratorOptions) {
return headers;
}

export interface IApolloClient<T> extends ApolloClient<T> {
export interface IApolloClient<T> extends ApolloClient {
Copy link
Author

@deep-foundation-sweepai deep-foundation-sweepai bot Sep 16, 2023

Choose a reason for hiding this comment

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

No changes made. Please add more details so I know what to change.

@@ -37,7 +43,7 @@ export function generateHeaders(options: IApolloClientGeneratorOptions) {
return headers;
}

export interface IApolloClient<T> extends ApolloClient<T> {
export interface IApolloClient<T> extends ApolloClient {
Copy link
Member

Choose a reason for hiding this comment

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

Sweep: use BaseApolloClient instead of ApolloClient and pass the type parameter to BaseApolloClient

Copy link
Author

@deep-foundation-sweepai deep-foundation-sweepai bot Sep 16, 2023

Choose a reason for hiding this comment

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

No changes made. Please add more details so I know what to change.

@@ -37,7 +43,7 @@ export function generateHeaders(options: IApolloClientGeneratorOptions) {
return headers;
}

export interface IApolloClient<T> extends ApolloClient<T> {
export interface IApolloClient<T> extends ApolloClient {
Copy link
Member

Choose a reason for hiding this comment

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

Sweep: use BaseApolloClient instead of ApolloClient and pass the type parameter to BaseApolloClient

Copy link
Author

@deep-foundation-sweepai deep-foundation-sweepai bot Sep 16, 2023

Choose a reason for hiding this comment

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

No changes made. Please add more details so I know what to change.

@deep-foundation-sweepai
Copy link
Author

GitHub actions yielded the following error.

The command that failed is npm run build. Here are the relevant lines from the logs:

npm ERR! Missing script: "build"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2023-09-20T10_44_04_543Z-debug-0.log

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

@deep-foundation-sweepai
Copy link
Author

deep-foundation-sweepai bot commented Sep 20, 2023

🚀 Wrote Changes

The command that failed is npm run build. Here are the relevant lines from the logs:

npm ERR! Missing script: "build"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2023-09-20T10_44_04_543Z-debug-0.log

Hi @deep-foundation-sweepai[bot],

I decided to make the following changes:

File Path Proposed Changes
package.json Modify package.json with contents:
• Add a "build" script to the "scripts" section of the package.json file. The exact command that the "build" script should run depends on the specific build process for this project. For example, if the project uses TypeScript, the "build" script might be "tsc".

@deep-foundation-sweepai
Copy link
Author

GitHub actions yielded the following error.

The command that failed is npm run build. Here are the relevant lines from the logs:

npm ERR! Missing script: "build"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2023-09-20T10_45_46_097Z-debug-0.log

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

@deep-foundation-sweepai
Copy link
Author

GitHub actions yielded the following error.

The command that failed is npm run build. Here are the relevant lines from the logs:

##[error]client.tsx(46,18): error TS2430: Interface 'IApolloClient<T>' incorrectly extends interface 'ApolloClient<any> & { path: string; ssl: boolean; jwt_token: string; }'.
Type 'IApolloClient<T>' is not assignable to type '{ path: string; ssl: boolean; jwt_token: string; }'.
Property 'path' is optional in type 'IApolloClient<T>' but required in type '{ path: string; ssl: boolean; jwt_token: string; }'.
##[error]client.tsx(139,3): error TS2322: Type 'IApolloClient<any>' is not assignable to type 'ApolloClient'.
Type 'IApolloClient<any>' is not assignable to type '{ path: string; ssl: boolean; jwt_token: string; }'.
Property 'path' is optional in type 'IApolloClient<any>' but required in type '{ path: string; ssl: boolean; jwt_token: string; }'.
##[error]Process completed with exit code 2.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

I'm getting the same errors 3 times in a row, so I will stop working on fixing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sweep Sweep your software chores
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep: add ApolloClient type to client.tsx
1 participant