-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid adding empty trailing comments to oneof unions
stephenh/ts-proto#1140 Signed-off-by: Andrew Haines <[email protected]>
- Loading branch information
Showing
3 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,5 +72,10 @@ | |
"tsx": "4.19.2", | ||
"typescript": "5.6.3", | ||
"typescript-eslint": "8.15.0" | ||
}, | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"[email protected]": "patches/[email protected]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
diff --git a/build/src/main.js b/build/src/main.js | ||
index 3e03249d11bae4b1ccc9000e0f4e41f1e4393f26..a6e519f26db63304ab4f29781261d2736d986382 100644 | ||
--- a/build/src/main.js | ||
+++ b/build/src/main.js | ||
@@ -851,7 +851,7 @@ function generateOneofProperty(ctx, messageDesc, oneofIndex, sourceInfo) { | ||
let fieldComments = []; | ||
(0, utils_1.maybeAddComment)(options, fieldInfo, fieldComments); | ||
const combinedComments = fieldComments.join("\n"); | ||
- return (0, ts_poet_1.code) `| // \n ${combinedComments} { ${mbReadonly}$case: '${fieldName}', ${mbReadonly}${valueName}: ${typeName} }`; | ||
+ return (0, ts_poet_1.code) `|${combinedComments ? " // " : ""}\n ${combinedComments} { ${mbReadonly}$case: '${fieldName}', ${mbReadonly}${valueName}: ${typeName} }`; | ||
})); | ||
const name = (0, case_1.maybeSnakeToCamel)(messageDesc.oneofDecl[oneofIndex].name, options); | ||
return (0, ts_poet_1.joinCode)([...outerComments, (0, ts_poet_1.code) `${mbReadonly}${name}?:`, unionType, (0, ts_poet_1.code) `| ${(0, utils_1.nullOrUndefined)(options)},`], { | ||
@@ -1155,7 +1155,7 @@ function generateDecode(ctx, fullName, messageDesc) { | ||
} | ||
chunks.push((0, ts_poet_1.code) ` | ||
const buf = reader.skip(tag & 7); | ||
- | ||
+ | ||
${unknownFieldsInitializerSnippet} | ||
const list = message._unknownFields${maybeNonNullAssertion}[tag]; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.