diff --git a/packages/angular/src/index.ts b/packages/angular/src/index.ts index b97a82f27..4aca4c1e3 100644 --- a/packages/angular/src/index.ts +++ b/packages/angular/src/index.ts @@ -133,7 +133,7 @@ const generateImplementation = ( const isFormData = override?.formData !== false; const isFormUrlEncoded = override?.formUrlEncoded !== false; const isExactOptionalPropertyTypes = - !!context.tsconfig?.compilerOptions?.exactOptionalPropertyTypes; + !!context.output.tsconfig?.compilerOptions?.exactOptionalPropertyTypes; const isBodyVerb = VERBS_WITH_BODY.includes(verb); const bodyForm = generateFormDataAndUrlEncodedFunction({ formData, diff --git a/packages/axios/src/index.ts b/packages/axios/src/index.ts index 7c43d1a95..3bb78c4ce 100644 --- a/packages/axios/src/index.ts +++ b/packages/axios/src/index.ts @@ -81,10 +81,10 @@ const generateAxiosImplementation = ( const isFormData = override?.formData !== false; const isFormUrlEncoded = override?.formUrlEncoded !== false; const isExactOptionalPropertyTypes = - !!context.tsconfig?.compilerOptions?.exactOptionalPropertyTypes; + !!context.output.tsconfig?.compilerOptions?.exactOptionalPropertyTypes; const isSyntheticDefaultImportsAllowed = isSyntheticDefaultImportsAllow( - context.tsconfig, + context.output.tsconfig, ); const bodyForm = generateFormDataAndUrlEncodedFunction({ diff --git a/packages/core/src/generators/interface.ts b/packages/core/src/generators/interface.ts index d6f110f2d..85ce17c9d 100644 --- a/packages/core/src/generators/interface.ts +++ b/packages/core/src/generators/interface.ts @@ -34,7 +34,7 @@ export const generateInterface = ({ model += jsDoc(schema); if (isEmptyObject) { - if (context.tslint) { + if (context.output.tslint) { model += '// tslint:disable-next-line:no-empty-interface\n'; } else { model += @@ -44,7 +44,7 @@ export const generateInterface = ({ if ( !generalJSTypesWithArray.includes(scalar.value) && - !context?.override?.useTypeOverInterfaces + !context?.output.override?.useTypeOverInterfaces ) { model += `export interface ${name} ${scalar.value}\n`; } else { diff --git a/packages/core/src/generators/schema-definition.ts b/packages/core/src/generators/schema-definition.ts index 43930ee44..ab6d77512 100644 --- a/packages/core/src/generators/schema-definition.ts +++ b/packages/core/src/generators/schema-definition.ts @@ -59,7 +59,7 @@ export const generateSchemasDefinition = ( resolvedValue.value, schemaName, resolvedValue.originalSchema?.['x-enumNames'], - context.override.useNativeEnums, + context.output.override.useNativeEnums, ); } else if (schemaName === resolvedValue.value && resolvedValue.isRef) { // Don't add type if schema has same name and the referred schema will be an interface diff --git a/packages/core/src/generators/verbs-options.ts b/packages/core/src/generators/verbs-options.ts index 4293068e1..0c4bc24ef 100644 --- a/packages/core/src/generators/verbs-options.ts +++ b/packages/core/src/generators/verbs-options.ts @@ -141,7 +141,7 @@ const generateVerbOptions = async ({ name: operationName, mutator: override?.mutator, workspace: context.workspace, - tsconfig: context.tsconfig, + tsconfig: context.output.tsconfig, }); const formData = @@ -151,7 +151,7 @@ const generateVerbOptions = async ({ name: operationName, mutator: override.formData, workspace: context.workspace, - tsconfig: context.tsconfig, + tsconfig: context.output.tsconfig, }) : undefined; @@ -162,7 +162,7 @@ const generateVerbOptions = async ({ name: operationName, mutator: override.formUrlEncoded, workspace: context.workspace, - tsconfig: context.tsconfig, + tsconfig: context.output.tsconfig, }) : undefined; @@ -173,7 +173,7 @@ const generateVerbOptions = async ({ name: 'paramsSerializer', mutator: override.paramsSerializer as NormalizedMutator, workspace: context.workspace, - tsconfig: context.tsconfig, + tsconfig: context.output.tsconfig, }) : undefined; diff --git a/packages/core/src/getters/array.ts b/packages/core/src/getters/array.ts index 7202001d2..aba571e90 100644 --- a/packages/core/src/getters/array.ts +++ b/packages/core/src/getters/array.ts @@ -20,7 +20,7 @@ export const getArray = ({ if (schema.items) { const resolvedObject = resolveObject({ schema: schema.items, - propName: name + context.override.components.schemas.itemSuffix, + propName: name + context.output.override.components.schemas.itemSuffix, context, }); return { diff --git a/packages/core/src/getters/body.ts b/packages/core/src/getters/body.ts index d28585ad6..b25a77267 100644 --- a/packages/core/src/getters/body.ts +++ b/packages/core/src/getters/body.ts @@ -16,7 +16,7 @@ export const getBody = ({ contentType?: OverrideOutputContentType; }): GetterBody => { const allBodyTypes = getResReqTypes( - [[context.override.components.requestBodies.suffix, requestBody]], + [[context.output.override.components.requestBodies.suffix, requestBody]], operationName, context, ); @@ -49,7 +49,8 @@ export const getBody = ({ let implementation = generalJSTypesWithArray.includes(definition.toLowerCase()) || filteredBodyTypes.length > 1 - ? camel(operationName) + context.override.components.requestBodies.suffix + ? camel(operationName) + + context.output.override.components.requestBodies.suffix : camel(definition); if (implementation) { diff --git a/packages/core/src/getters/combine.ts b/packages/core/src/getters/combine.ts index c3dff71de..9bd7b27b2 100644 --- a/packages/core/src/getters/combine.ts +++ b/packages/core/src/getters/combine.ts @@ -11,6 +11,7 @@ import { import { getNumberWord, pascal } from '../utils'; import { getEnumImplementation } from './enum'; import { getScalar } from './scalar'; +import uniq from 'lodash.uniq'; type CombinedData = { imports: GeneratorImport[]; @@ -34,10 +35,12 @@ const combineValues = ({ resolvedData, resolvedValue, separator, + context, }: { resolvedData: CombinedData; resolvedValue?: ScalarValue; separator: Separator; + context: ContextSpecs; }) => { const isAllEnums = resolvedData.isEnum.every((v) => v); @@ -55,7 +58,7 @@ const combineValues = ({ let values = resolvedData.values; const hasObjectSubschemas = resolvedData.allProperties.length; - if (hasObjectSubschemas) { + if (hasObjectSubschemas && context.output.unionAddMissingProperties) { values = []; // the list of values will be rebuilt to add missing properties (if exist) in subschemas for (let i = 0; i < resolvedData.values.length; i += 1) { const subSchema = resolvedData.originalSchema[i]; @@ -64,8 +67,10 @@ const combineValues = ({ continue; } - const missingProperties = resolvedData.allProperties.filter( - (p) => !Object.keys(subSchema.properties!).includes(p), + const missingProperties = uniq( + resolvedData.allProperties.filter( + (p) => !Object.keys(subSchema.properties!).includes(p), + ), ); values.push( `${resolvedData.values[i]}${ @@ -155,7 +160,12 @@ export const combineSchemas = ({ resolvedValue = getScalar({ item: omit(schema, separator), name, context }); } - const value = combineValues({ resolvedData, separator, resolvedValue }); + const value = combineValues({ + resolvedData, + separator, + resolvedValue, + context, + }); if (isAllEnums && name && items.length > 1) { const newEnum = `\n\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport const ${pascal( diff --git a/packages/core/src/getters/props.ts b/packages/core/src/getters/props.ts index 1a45d884f..8ab382c94 100644 --- a/packages/core/src/getters/props.ts +++ b/packages/core/src/getters/props.ts @@ -61,7 +61,7 @@ export const getProps = ({ }; let paramGetterProps: GetterProps; - if (context.override.useNamedParameters && params.length > 0) { + if (context.output.override.useNamedParameters && params.length > 0) { const parameterTypeName = `${pascal(operationName)}PathParameters`; const name = 'pathParams'; diff --git a/packages/core/src/getters/query-params.test.ts b/packages/core/src/getters/query-params.test.ts index 17bfce8f6..a8ee44f72 100644 --- a/packages/core/src/getters/query-params.test.ts +++ b/packages/core/src/getters/query-params.test.ts @@ -6,9 +6,11 @@ import { getQueryParams } from './query-params'; // Mock context for getQueryParams const context: ContextSpecs = { specs: {}, - // @ts-ignore - override: { - useDates: true, + output: { + // @ts-expect-error + override: { + useDates: true, + }, }, }; diff --git a/packages/core/src/getters/query-params.ts b/packages/core/src/getters/query-params.ts index 497a40057..a0ceefa38 100644 --- a/packages/core/src/getters/query-params.ts +++ b/packages/core/src/getters/query-params.ts @@ -72,7 +72,7 @@ const getQueryParamsTypes = ( resolvedValue.value, enumName, resolvedValue.originalSchema?.['x-enumNames'], - context.override.useNativeEnums, + context.output.override.useNativeEnums, ); return { diff --git a/packages/core/src/getters/ref.ts b/packages/core/src/getters/ref.ts index 9f6206468..96d674d6f 100644 --- a/packages/core/src/getters/ref.ts +++ b/packages/core/src/getters/ref.ts @@ -54,7 +54,7 @@ export const getRefInfo = ( .map((part) => part.replace(regex, '/')); const suffix = refPaths - ? get(context.override, [...refPaths.slice(0, 2), 'suffix'], '') + ? get(context.output.override, [...refPaths.slice(0, 2), 'suffix'], '') : ''; const originalName = ref diff --git a/packages/core/src/getters/scalar.ts b/packages/core/src/getters/scalar.ts index 07b9f26d9..a82b49ed9 100644 --- a/packages/core/src/getters/scalar.ts +++ b/packages/core/src/getters/scalar.ts @@ -31,7 +31,7 @@ export const getScalar = ({ case 'number': case 'integer': { let value = - item.format === 'int64' && context.override.useBigInt + item.format === 'int64' && context.output.override.useBigInt ? 'bigint' : 'number'; let isEnum = false; @@ -100,7 +100,7 @@ export const getScalar = ({ value = 'Blob'; } - if (context.override.useDates) { + if (context.output.override.useDates) { if (item.format === 'date' || item.format === 'date-time') { value = 'Date'; } diff --git a/packages/core/src/resolvers/object.ts b/packages/core/src/resolvers/object.ts index cdde57e9e..a75e9bbcb 100644 --- a/packages/core/src/resolvers/object.ts +++ b/packages/core/src/resolvers/object.ts @@ -52,7 +52,7 @@ const resolveObjectOriginal = ({ resolvedValue.value, propName, resolvedValue.originalSchema?.['x-enumNames'], - context.override.useNativeEnums, + context.output.override.useNativeEnums, ); return { diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index fd092b0ed..dfff569ff 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -57,6 +57,7 @@ export type NormalizedOutputOptions = { baseUrl?: string; allParamsOptional: boolean; urlEncodeParameters: boolean; + unionAddMissingProperties: boolean; }; export type NormalizedParamsSerializerOptions = { @@ -174,6 +175,7 @@ export type OutputOptions = { baseUrl?: string; allParamsOptional?: boolean; urlEncodeParameters?: boolean; + unionAddMissingProperties?: boolean; }; export type SwaggerParserOptions = Omit & { @@ -426,12 +428,9 @@ export interface ContextSpecs { specKey: string; target: string; workspace: string; - tslint: boolean; specs: Record; - override: NormalizedOverrideOutput; - tsconfig?: Tsconfig; - packageJson?: PackageJson; parents?: string[]; + output: NormalizedOutputOptions; } export interface GlobalOptions { diff --git a/packages/mock/src/faker/getters/scalar.ts b/packages/mock/src/faker/getters/scalar.ts index cdd88818d..1da5d4fff 100644 --- a/packages/mock/src/faker/getters/scalar.ts +++ b/packages/mock/src/faker/getters/scalar.ts @@ -78,7 +78,7 @@ export const getMockScalar = ({ } if ( - (context.override?.mock?.useExamples || mockOptions?.useExamples) && + (context.output.override?.mock?.useExamples || mockOptions?.useExamples) && item.example ) { return { diff --git a/packages/mock/src/msw/mocks.ts b/packages/mock/src/msw/mocks.ts index 0b516f36d..25206ab7e 100644 --- a/packages/mock/src/msw/mocks.ts +++ b/packages/mock/src/msw/mocks.ts @@ -135,7 +135,10 @@ export const getResponsesMockDefinition = ({ acc, { value: definition, originalSchema, example, examples, imports, isRef }, ) => { - if (context.override?.mock?.useExamples || mockOptions?.useExamples) { + if ( + context.output.override?.mock?.useExamples || + mockOptions?.useExamples + ) { const exampleValue = example || originalSchema?.example || diff --git a/packages/orval/src/import-open-api.ts b/packages/orval/src/import-open-api.ts index 5bc45745b..536019eab 100644 --- a/packages/orval/src/import-open-api.ts +++ b/packages/orval/src/import-open-api.ts @@ -41,10 +41,7 @@ export const importOpenApi = async ({ target, workspace, specs, - override: output.override, - tslint: output.tslint, - tsconfig: output.tsconfig, - packageJson: output.packageJson, + output, }, }); @@ -113,10 +110,7 @@ const getApiSchemas = ({ target, workspace, specs, - override: output.override, - tslint: output.tslint, - tsconfig: output.tsconfig, - packageJson: output.packageJson, + output, }; const schemaDefinition = generateSchemasDefinition( diff --git a/packages/orval/src/utils/options.ts b/packages/orval/src/utils/options.ts index cecda0976..c37cfacfb 100644 --- a/packages/orval/src/utils/options.ts +++ b/packages/orval/src/utils/options.ts @@ -135,6 +135,8 @@ export const normalizeOptions = async ( headers: outputOptions.headers ?? false, indexFiles: outputOptions.indexFiles ?? true, baseUrl: outputOptions.baseUrl, + unionAddMissingProperties: + outputOptions.unionAddMissingProperties ?? false, override: { ...outputOptions.override, mock: { diff --git a/packages/query/src/index.ts b/packages/query/src/index.ts index 64df35623..f8ba724fe 100644 --- a/packages/query/src/index.ts +++ b/packages/query/src/index.ts @@ -391,10 +391,10 @@ const generateQueryRequestFunction = ( const hasSignal = !!override.query.signal; const isSyntheticDefaultImportsAllowed = isSyntheticDefaultImportsAllow( - context.tsconfig, + context.output.tsconfig, ); const isExactOptionalPropertyTypes = - !!context.tsconfig?.compilerOptions?.exactOptionalPropertyTypes; + !!context.output.tsconfig?.compilerOptions?.exactOptionalPropertyTypes; const isBodyVerb = VERBS_WITH_BODY.includes(verb); const bodyForm = generateFormDataAndUrlEncodedFunction({ @@ -1117,19 +1117,19 @@ const generateQueryHook = async ( const isRequestOptions = override?.requestOptions !== false; const operationQueryOptions = operations[operationId]?.query; const isExactOptionalPropertyTypes = - !!context.tsconfig?.compilerOptions?.exactOptionalPropertyTypes; + !!context.output.tsconfig?.compilerOptions?.exactOptionalPropertyTypes; const hasVueQueryV4 = OutputClient.VUE_QUERY === outputClient && - (!isVueQueryV3(context.packageJson) || query.version === 4); + (!isVueQueryV3(context.output.packageJson) || query.version === 4); const hasSvelteQueryV4 = OutputClient.SVELTE_QUERY === outputClient && - (!isSvelteQueryV3(context.packageJson) || query.version === 4); + (!isSvelteQueryV3(context.output.packageJson) || query.version === 4); const hasQueryV5 = query.version === 5 || isQueryV5( - context.packageJson, + context.output.packageJson, outputClient as 'react-query' | 'vue-query' | 'svelte-query', ); @@ -1156,7 +1156,7 @@ const generateQueryHook = async ( mutator: query.queryKey, name: `${operationName}QueryKey`, workspace: context.workspace, - tsconfig: context.tsconfig, + tsconfig: context.output.tsconfig, }) : undefined; @@ -1166,7 +1166,7 @@ const generateQueryHook = async ( mutator: query.queryOptions, name: `${operationName}QueryOptions`, workspace: context.workspace, - tsconfig: context.tsconfig, + tsconfig: context.output.tsconfig, }) : undefined; @@ -1308,7 +1308,7 @@ const generateQueryHook = async ( mutator: query.mutationOptions, name: `${operationName}MutationOptions`, workspace: context.workspace, - tsconfig: context.tsconfig, + tsconfig: context.output.tsconfig, }) : undefined; diff --git a/packages/swr/src/index.ts b/packages/swr/src/index.ts index 28df90ec0..3b9ca82ba 100644 --- a/packages/swr/src/index.ts +++ b/packages/swr/src/index.ts @@ -125,10 +125,10 @@ const generateSwrRequestFunction = ( const isFormData = override?.formData !== false; const isFormUrlEncoded = override?.formUrlEncoded !== false; const isExactOptionalPropertyTypes = - !!context.tsconfig?.compilerOptions?.exactOptionalPropertyTypes; + !!context.output.tsconfig?.compilerOptions?.exactOptionalPropertyTypes; const isBodyVerb = VERBS_WITH_BODY.includes(verb); const isSyntheticDefaultImportsAllowed = isSyntheticDefaultImportsAllow( - context.tsconfig, + context.output.tsconfig, ); const bodyForm = generateFormDataAndUrlEncodedFunction({ diff --git a/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts b/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts index a1f728426..b47ec2af0 100644 --- a/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts +++ b/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts @@ -12,7 +12,6 @@ import { useSuspenseQuery, } from '@tanstack/react-query'; import type { - InfiniteData, MutationFunction, QueryFunction, QueryKey, @@ -87,24 +86,16 @@ export const getListPetsQueryKey = ( }; export const getListPetsInfiniteQueryOptions = < - TData = InfiniteData< - Awaited>, - ListPetsParams['limit'] - >, + TData = Awaited>, TError = ErrorType, >( params?: ListPetsParams, version: number = 1, options?: { - query?: Partial< - UseInfiniteQueryOptions< - Awaited>, - TError, - TData, - Awaited>, - QueryKey, - ListPetsParams['limit'] - > + query?: UseInfiniteQueryOptions< + Awaited>, + TError, + TData >; }, ) => { @@ -113,12 +104,9 @@ export const getListPetsInfiniteQueryOptions = < const queryKey = queryOptions?.queryKey ?? getListPetsQueryKey(params, version); - const queryFn: QueryFunction< - Awaited>, - QueryKey, - ListPetsParams['limit'] - > = ({ pageParam }) => - listPets({ ...params, limit: pageParam || params?.['limit'] }, version); + const queryFn: QueryFunction>> = ({ + pageParam, + }) => listPets({ ...params, limit: pageParam || params?.['limit'] }, version); return { queryKey, @@ -128,10 +116,7 @@ export const getListPetsInfiniteQueryOptions = < } as UseInfiniteQueryOptions< Awaited>, TError, - TData, - Awaited>, - QueryKey, - ListPetsParams['limit'] + TData > & { queryKey: QueryKey }; }; @@ -144,24 +129,16 @@ export type ListPetsInfiniteQueryError = ErrorType; * @summary List all pets */ export const useListPetsInfinite = < - TData = InfiniteData< - Awaited>, - ListPetsParams['limit'] - >, + TData = Awaited>, TError = ErrorType, >( params?: ListPetsParams, version: number = 1, options?: { - query?: Partial< - UseInfiniteQueryOptions< - Awaited>, - TError, - TData, - Awaited>, - QueryKey, - ListPetsParams['limit'] - > + query?: UseInfiniteQueryOptions< + Awaited>, + TError, + TData >; }, ): UseInfiniteQueryResult & { queryKey: QueryKey } => { @@ -188,8 +165,10 @@ export const getListPetsQueryOptions = < params?: ListPetsParams, version: number = 1, options?: { - query?: Partial< - UseQueryOptions>, TError, TData> + query?: UseQueryOptions< + Awaited>, + TError, + TData >; }, ) => { @@ -226,8 +205,10 @@ export const useListPets = < params?: ListPetsParams, version: number = 1, options?: { - query?: Partial< - UseQueryOptions>, TError, TData> + query?: UseQueryOptions< + Awaited>, + TError, + TData >; }, ): UseQueryResult & { queryKey: QueryKey } => { @@ -249,12 +230,10 @@ export const getListPetsSuspenseQueryOptions = < params?: ListPetsParams, version: number = 1, options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > + query?: UseSuspenseQueryOptions< + Awaited>, + TError, + TData >; }, ) => { @@ -293,12 +272,10 @@ export const useListPetsSuspense = < params?: ListPetsParams, version: number = 1, options?: { - query?: Partial< - UseSuspenseQueryOptions< - Awaited>, - TError, - TData - > + query?: UseSuspenseQueryOptions< + Awaited>, + TError, + TData >; }, ): UseSuspenseQueryResult & { queryKey: QueryKey } => { @@ -319,24 +296,16 @@ export const useListPetsSuspense = < }; export const getListPetsSuspenseInfiniteQueryOptions = < - TData = InfiniteData< - Awaited>, - ListPetsParams['limit'] - >, + TData = Awaited>, TError = ErrorType, >( params?: ListPetsParams, version: number = 1, options?: { - query?: Partial< - UseSuspenseInfiniteQueryOptions< - Awaited>, - TError, - TData, - Awaited>, - QueryKey, - ListPetsParams['limit'] - > + query?: UseSuspenseInfiniteQueryOptions< + Awaited>, + TError, + TData >; }, ) => { @@ -345,12 +314,9 @@ export const getListPetsSuspenseInfiniteQueryOptions = < const queryKey = queryOptions?.queryKey ?? getListPetsQueryKey(params, version); - const queryFn: QueryFunction< - Awaited>, - QueryKey, - ListPetsParams['limit'] - > = ({ pageParam }) => - listPets({ ...params, limit: pageParam || params?.['limit'] }, version); + const queryFn: QueryFunction>> = ({ + pageParam, + }) => listPets({ ...params, limit: pageParam || params?.['limit'] }, version); return { queryKey, @@ -360,10 +326,7 @@ export const getListPetsSuspenseInfiniteQueryOptions = < } as UseSuspenseInfiniteQueryOptions< Awaited>, TError, - TData, - Awaited>, - QueryKey, - ListPetsParams['limit'] + TData > & { queryKey: QueryKey }; }; @@ -376,24 +339,16 @@ export type ListPetsSuspenseInfiniteQueryError = ErrorType; * @summary List all pets */ export const useListPetsSuspenseInfinite = < - TData = InfiniteData< - Awaited>, - ListPetsParams['limit'] - >, + TData = Awaited>, TError = ErrorType, >( params?: ListPetsParams, version: number = 1, options?: { - query?: Partial< - UseSuspenseInfiniteQueryOptions< - Awaited>, - TError, - TData, - Awaited>, - QueryKey, - ListPetsParams['limit'] - > + query?: UseSuspenseInfiniteQueryOptions< + Awaited>, + TError, + TData >; }, ): UseSuspenseInfiniteQueryResult & { queryKey: QueryKey } => { @@ -575,8 +530,10 @@ export const getShowPetByIdQueryOptions = < petId: string, version: number = 1, options?: { - query?: Partial< - UseQueryOptions>, TError, TData> + query?: UseQueryOptions< + Awaited>, + TError, + TData >; }, ) => { @@ -616,8 +573,10 @@ export const useShowPetById = < petId: string, version: number = 1, options?: { - query?: Partial< - UseQueryOptions>, TError, TData> + query?: UseQueryOptions< + Awaited>, + TError, + TData >; }, ): UseQueryResult & { queryKey: QueryKey } => { diff --git a/samples/react-query/basic/src/api/model/dog.ts b/samples/react-query/basic/src/api/model/dog.ts index 1f71f2d09..17c860874 100644 --- a/samples/react-query/basic/src/api/model/dog.ts +++ b/samples/react-query/basic/src/api/model/dog.ts @@ -9,11 +9,11 @@ import type { Dachshund } from './dachshund'; import type { DogType } from './dogType'; export type Dog = - | (Labradoodle & { length?: never } & { + | (Labradoodle & { barksPerMinute?: number; type: DogType; }) - | (Dachshund & { cuteness?: never } & { + | (Dachshund & { barksPerMinute?: number; type: DogType; }); diff --git a/samples/react-query/basic/src/api/model/pet.ts b/samples/react-query/basic/src/api/model/pet.ts index ad71ecbfb..b7960ec0a 100644 --- a/samples/react-query/basic/src/api/model/pet.ts +++ b/samples/react-query/basic/src/api/model/pet.ts @@ -10,7 +10,7 @@ import type { PetCallingCode } from './petCallingCode'; import type { PetCountry } from './petCountry'; export type Pet = - | (Dog & { petsRequested?: never } & { + | (Dog & { '@id'?: string; callingCode?: PetCallingCode; country?: PetCountry; @@ -19,7 +19,7 @@ export type Pet = name: string; tag?: string; }) - | (Cat & { barksPerMinute?: never } & { + | (Cat & { '@id'?: string; callingCode?: PetCallingCode; country?: PetCountry;