deep-foundation / hasura

The Unlicense
11 stars 4 forks source link

Extend ApolloClient with custom type #10

Closed deep-foundation-sweepai[bot] closed 1 year ago

deep-foundation-sweepai[bot] commented 1 year ago

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

// 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:

deep-foundation-sweepai[bot] commented 1 year ago

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[bot] commented 1 year ago

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.