bootsharp icon indicating copy to clipboard operation
bootsharp copied to clipboard

Support typedefs for nullable collection elements

Open elringus opened this issue 1 year ago • 0 comments

Currently, we can detect when a property, method argument and method return type is explicitly marked as nullable (either Nullable<> or has ? in nullable context) and generate corresponding TypeScript declaration with either ? or undefined modifier:

https://github.com/Elringus/DotNetJS/blob/456c1b5af62e88dddcc1215767ce2922529d9f52/DotNet/Packer/Utilities/TypeUtilities.cs#L43-L63

However, I'm not sure if it's possible to detect when a collection element type has nullable modifier, eg string?[] or List<string?>. NullabilityInfoContext doesn't seem to have a way to detect that.

If anyone have any idea how to infer nullability of collection and array element types, please let us know here.

elringus avatar Sep 25 '22 17:09 elringus