Skip to content

Commit

Permalink
chore: define options for swr by type (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
soartec-lab authored Jan 2, 2024
1 parent 95bb897 commit f67681f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
16 changes: 7 additions & 9 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ export type NormalizedOverrideOutput = {
};
query: NormalizedQueryOptions;
angular: Required<AngularOptions>;
swr: {
options?: any;
};
swr: SwrOptions;
operationName?: (
operation: OperationObject,
route: string,
Expand Down Expand Up @@ -299,9 +297,7 @@ export type OverrideOutput = {
};
};
query?: QueryOptions;
swr?: {
options?: any;
};
swr?: SwrOptions;
angular?: AngularOptions;
operationName?: (
operation: OperationObject,
Expand Down Expand Up @@ -358,6 +354,10 @@ export type AngularOptions = {
provideIn?: 'root' | 'any' | boolean;
};

export type SwrOptions = {
options?: any;
};

export type InputTransformerFn = (spec: OpenAPIObject) => OpenAPIObject;

type InputTransformer = string | InputTransformerFn;
Expand All @@ -375,9 +375,7 @@ export type OperationOptions = {
};
query?: QueryOptions;
angular?: Required<AngularOptions>;
swr?: {
options?: any;
};
swr?: SwrOptions;
operationName?: (
operation: OperationObject,
route: string,
Expand Down
3 changes: 2 additions & 1 deletion packages/swr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
Verbs,
VERBS_WITH_BODY,
jsDoc,
SwrOptions,
} from '@orval/core';

const AXIOS_DEPENDENCIES: GeneratorDependency[] = [
Expand Down Expand Up @@ -232,7 +233,7 @@ const generateSwrImplementation = ({
props: GetterProps;
response: GetterResponse;
mutator?: GeneratorMutator;
swrOptions: { options?: any };
swrOptions: SwrOptions;
doc?: string;
}) => {
const swrProps = toObjectString(props, 'implementation');
Expand Down

0 comments on commit f67681f

Please sign in to comment.