Skip to content

Commit

Permalink
Fix build error (#2722)
Browse files Browse the repository at this point in the history
* fix moinitor build error

* update

---------

Co-authored-by: Mary Gao <yanmeigao1210@gmail.com>
  • Loading branch information
v-jiaodi and MaryGao authored Aug 1, 2024
1 parent 73b9e50 commit 124ff9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/typespec-ts/src/modular/buildCodeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1231,17 +1231,17 @@ function applyEncoding(

function mergeFormatAndEncoding(
format: string | undefined,
encoding: string,
encoding: string | undefined,
encodeAsFormat: string | undefined
): string {
): string | undefined {
switch (format) {
case undefined:
return encodeAsFormat ?? encoding;
return encodeAsFormat ?? encoding ?? format;
case "date-time":
return encoding;
case "duration":
default:
return encodeAsFormat ?? encoding;
return encodeAsFormat ?? encoding ?? format;
}
}

Expand Down
8 changes: 4 additions & 4 deletions packages/typespec-ts/src/utils/modelUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,17 @@ function applyEncoding(

function mergeFormatAndEncoding(
format: string | undefined,
encoding: string,
encoding: string | undefined,
encodeAsFormat: string | undefined
): string {
): string | undefined {
switch (format) {
case undefined:
return encodeAsFormat ?? encoding;
return encodeAsFormat ?? encoding ?? format;
case "date-time":
return encoding;
case "duration":
default:
return encodeAsFormat ?? encoding;
return encodeAsFormat ?? encoding ?? format;
}
}

Expand Down

0 comments on commit 124ff9b

Please sign in to comment.