From 5bde88e90b74be35cc38d0d7ca1f00e257dadafb Mon Sep 17 00:00:00 2001 From: K35 Date: Tue, 11 Jan 2022 08:51:35 +0000 Subject: [PATCH] Remove some C# warnings and making the client API safer by declaring nullables --- lib/jrpc.js | 2 +- package.json | 2 +- src/targets/csharp.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/jrpc.js b/lib/jrpc.js index 3668e5f..bbbfb5f 100755 --- a/lib/jrpc.js +++ b/lib/jrpc.js @@ -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, `}`); diff --git a/package.json b/package.json index 99b7ccc..fd076a3 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/targets/csharp.ts b/src/targets/csharp.ts index b21d3ab..2699120 100644 --- a/src/targets/csharp.ts +++ b/src/targets/csharp.ts @@ -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,