Skip to content

Commit

Permalink
fix(code-gen): always generate the Pretty type even if global api c…
Browse files Browse the repository at this point in the history
…lients is on
  • Loading branch information
dirkdev98 committed Jun 2, 2023
1 parent 3b246fa commit 550143b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/code-gen/src/api-client/react-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ import { apiClientDistilledTargetInfo } from "./generator.js";
export function reactQueryGenerateCommonFile(generateContext) {
const distilledTargetInfo = apiClientDistilledTargetInfo(generateContext);

if (distilledTargetInfo.useGlobalClients) {
return;
}

const file = fileContextCreateGeneric(
generateContext,
`common/api-client-wrapper.tsx`,
Expand All @@ -39,13 +35,17 @@ export function reactQueryGenerateCommonFile(generateContext) {

const importCollector = JavascriptImportCollector.getImportCollector(file);

fileWrite(file, `export type Pretty<T> = { [K in keyof T]: T[K] } & {};`);

if (distilledTargetInfo.useGlobalClients) {
return;
}

importCollector.raw(`import React from "react";`);
importCollector.destructure("react", "createContext");
importCollector.destructure("react", "PropsWithChildren");
importCollector.destructure("react", "useContext");

fileWrite(file, `export type Pretty<T> = { [K in keyof T]: T[K] } & {};`);

if (distilledTargetInfo.isAxios) {
importCollector.destructure("axios", "AxiosInstance");

Expand Down

0 comments on commit 550143b

Please sign in to comment.