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

Extend ApolloClient with custom type #10

Closed

Conversation

deep-foundation-sweepai[bot]
Copy link

Description

This PR introduces a custom ApolloClient type that extends the base ApolloClient from the '@apollo/client' package with additional properties 'path' and 'ssl'. This custom type provides more specific type information for the ApolloClient instances used in the project.

Summary of Changes

  • Defined a custom ApolloClient type that extends the base ApolloClient and includes additional properties 'path' and 'ssl'.
  • Replaced all instances of the base ApolloClient type with the custom ApolloClient type in the 'client.tsx' file. This includes the return type of the 'generateApolloClient' function and the type of the 'client' constant within the function.
// Define the custom ApolloClient type
import { ApolloClient as BaseApolloClient } from '@apollo/client';
export type ApolloClient = BaseApolloClient<any> & {
  path: string;
  ssl: boolean;
}

// Use the custom ApolloClient type in the 'generateApolloClient' function
export function generateApolloClient(
  options: IApolloClientGeneratorOptions,
  forwardingArguments?: {
    ApolloClient?: any;
    InMemoryCache?: any;
  },
): ApolloClient {
  // function body
  const client: ApolloClient = new ApolloClient({
    // client options
  });
  // rest of the function
}

Fixes #8.


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

git checkout sweep/extend-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.

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-12T06_10_13_955Z-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.

@deep-foundation-sweepai
Copy link
Author

GitHub actions yielded the following error.

##[error]client.tsx(92,4): error TS1128: Declaration or statement expected.
##[error]client.tsx(139,1): error TS1128: Declaration or statement expected.
##[error]Process completed with exit code 2.

The command that failed is npx tsc --project tsconfig.json.

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 deep-foundation-sweepai bot deleted the sweep/extend-apollo-client-type branch September 12, 2023 11:19
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
0 participants