Skip to content

Commit

Permalink
[typescript-fetch] fix #18876 Type error in oneOf when legacyDiscrimi…
Browse files Browse the repository at this point in the history
…natorBehavior is false (#18877)
  • Loading branch information
fa0311 committed Jun 7, 2024
1 parent 4be5971 commit dc81339
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function {{classname}}FromJSONTyped(json: any, ignoreDiscriminator: boole
switch (json['{{discriminator.propertyBaseName}}']) {
{{#discriminator.mappedModels}}
case '{{mappingName}}':
return Object.assign({}, {{modelName}}FromJSONTyped(json, true), { {{discriminator.propertyName}}: '{{mappingName}}' });
return Object.assign({}, {{modelName}}FromJSONTyped(json, true), { {{discriminator.propertyName}}: '{{mappingName}}' } as const);
{{/discriminator.mappedModels}}
default:
throw new Error(`No variant of {{classname}} exists with '{{discriminator.propertyName}}=${json['{{discriminator.propertyName}}']}'`);
Expand Down

0 comments on commit dc81339

Please sign in to comment.