Skip to content

Commit

Permalink
fix(prefetch): import QueryClient type (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
seriouslag authored May 3, 2024
1 parent c5460df commit 5035fb5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/createImports.mts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export const createImports = ({
false,
undefined,
ts.factory.createNamedImports([
ts.factory.createImportSpecifier(
true,
undefined,
ts.factory.createIdentifier("QueryClient")
),
ts.factory.createImportSpecifier(
false,
undefined,
Expand Down
8 changes: 4 additions & 4 deletions tests/__snapshots__/createSource.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export * from "./queries";
exports[`createSource > createSource 2`] = `
"// generated with @7nohe/openapi-react-query-codegen@1.0.0
import { useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { DefaultService } from "../requests/services.gen";
import { Pet, NewPet, Error, $OpenApiTs } from "../requests/types.gen";
export type DefaultServiceFindPetsDefaultResponse = Awaited<ReturnType<typeof DefaultService.findPets>>;
Expand Down Expand Up @@ -41,7 +41,7 @@ exports[`createSource > createSource 3`] = `
"// generated with @7nohe/openapi-react-query-codegen@1.0.0
import * as Common from "./common";
import { useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { DefaultService } from "../requests/services.gen";
import { Pet, NewPet, Error, $OpenApiTs } from "../requests/types.gen";
/**
Expand Down Expand Up @@ -119,7 +119,7 @@ exports[`createSource > createSource 4`] = `
"// generated with @7nohe/openapi-react-query-codegen@1.0.0
import * as Common from "./common";
import { useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { DefaultService } from "../requests/services.gen";
import { Pet, NewPet, Error, $OpenApiTs } from "../requests/types.gen";
/**
Expand Down Expand Up @@ -164,7 +164,7 @@ exports[`createSource > createSource 5`] = `
"// generated with @7nohe/openapi-react-query-codegen@1.0.0
import * as Common from "./common";
import { useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { type QueryClient, useQuery, useSuspenseQuery, useMutation, UseQueryResult, UseQueryOptions, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
import { DefaultService } from "../requests/services.gen";
import { Pet, NewPet, Error, $OpenApiTs } from "../requests/types.gen";
/**
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/generate.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export * from "./queries";
exports[`generate > prefetch.ts 1`] = `
"// generated with @7nohe/openapi-react-query-codegen@1.0.0
import { type QueryClient } from "@tanstack/react-query";
import { DefaultService } from "../requests/services.gen";
import * as Common from "./common";
/**
Expand Down

0 comments on commit 5035fb5

Please sign in to comment.