Remove some C# warnings and making the client API safer by declaring nullables

This commit is contained in:
K35 2022-01-11 08:51:35 +00:00
parent d85ed22ea7
commit 5bde88e90b
3 changed files with 3 additions and 3 deletions

View File

@ -10549,7 +10549,7 @@ var CSharpTarget = class extends CompileTarget {
a(1, `}`);
} else {
let ret = fnc.return ? fnc.return.array ? `IList<${toCSharpType(fnc.return.type)}>` : toCSharpType(fnc.return.type) : void 0;
a(1, `public async Task<${ret}> ${fnc.name}(${params}) {`);
a(1, `public async Task<${ret}?> ${fnc.name}(${params}) {`);
genParam();
a(2, `return await this.Client.SendRequest<${ret}>("${definition.name}.${fnc.name}", param);`);
a(1, `}`);

View File

@ -1,6 +1,6 @@
{
"name": "@hibas123/jrpcgen",
"version": "1.0.22",
"version": "1.0.23",
"main": "lib/index.js",
"license": "MIT",
"packageManager": "yarn@3.1.1",

View File

@ -174,7 +174,7 @@ export class CSharpTarget extends CompileTarget<{ csharp_namespace: string }> {
? `IList<${toCSharpType(fnc.return.type)}>`
: toCSharpType(fnc.return.type)
: undefined;
a(1, `public async Task<${ret}> ${fnc.name}(${params}) {`);
a(1, `public async Task<${ret}?> ${fnc.name}(${params}) {`);
genParam();
a(
2,