ts-proto 1.156.1 → 1.156.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.js +4 -4
- package/build/plugin.js +4 -2
- package/package.json +1 -1
package/build/main.js
CHANGED
|
@@ -1801,17 +1801,17 @@ function generateFromPartial(ctx, fullName, messageDesc) {
|
|
|
1801
1801
|
if (ctx.options.useExactTypes) {
|
|
1802
1802
|
chunks.push((0, ts_poet_1.code) `
|
|
1803
1803
|
create<I extends ${utils.Exact}<${utils.DeepPartial}<${fullName}>, I>>(base?: I): ${fullName} {
|
|
1804
|
+
return ${fullName}.fromPartial(base ?? ({} as any));
|
|
1805
|
+
},
|
|
1804
1806
|
`);
|
|
1805
1807
|
}
|
|
1806
1808
|
else {
|
|
1807
1809
|
chunks.push((0, ts_poet_1.code) `
|
|
1808
1810
|
create(base?: ${utils.DeepPartial}<${fullName}>): ${fullName} {
|
|
1811
|
+
return ${fullName}.fromPartial(base ?? {});
|
|
1812
|
+
},
|
|
1809
1813
|
`);
|
|
1810
1814
|
}
|
|
1811
|
-
chunks.push((0, ts_poet_1.code) `
|
|
1812
|
-
return ${fullName}.fromPartial(base ?? {})
|
|
1813
|
-
`);
|
|
1814
|
-
chunks.push((0, ts_poet_1.code) `},`, (0, ts_poet_1.code) ``);
|
|
1815
1815
|
// create the fromPartial function declaration
|
|
1816
1816
|
const paramName = messageDesc.field.length > 0 ? "object" : "_";
|
|
1817
1817
|
if (ctx.options.useExactTypes) {
|
package/build/plugin.js
CHANGED
|
@@ -20,17 +20,19 @@ async function main() {
|
|
|
20
20
|
let filesToGenerate;
|
|
21
21
|
if (options.emitImportedFiles) {
|
|
22
22
|
const fileSet = new Set();
|
|
23
|
-
|
|
23
|
+
function addFilesUnlessAliased(filenames) {
|
|
24
24
|
filenames
|
|
25
25
|
.filter((name) => !options.M[name])
|
|
26
26
|
.forEach((name) => {
|
|
27
|
+
if (fileSet.has(name))
|
|
28
|
+
return;
|
|
27
29
|
fileSet.add(name);
|
|
28
30
|
const file = request.protoFile.find((file) => file.name === name);
|
|
29
31
|
if (file && file.dependency.length > 0) {
|
|
30
32
|
addFilesUnlessAliased(file.dependency);
|
|
31
33
|
}
|
|
32
34
|
});
|
|
33
|
-
}
|
|
35
|
+
}
|
|
34
36
|
addFilesUnlessAliased(request.fileToGenerate);
|
|
35
37
|
filesToGenerate = request.protoFile.filter((file) => fileSet.has(file.name));
|
|
36
38
|
}
|