microsoft / microsoft/node-api-dotnet

Report warning for exported generic types or methods

Open
#298 1 comment 0 reactions 1 assignee View on GitHub

@jasongin is already working on this.

Since May 17, 2024.

bug build
Dominant language
C#
Stars
783
Forks
80
PR merge metrics
No merged PRs in 30d

Description

I'm splitting this out from #289. This issue will be about improving how the unsupported generic types and methods are handled by the build. #289 will be about adding (partial) support for exporting generic types and methods to JS from a .NET module.

The following are examples of unsupported generic exports:

[JSExport]
public class GenericClass<T> { ... }
public static class ClassWithGenericMethod
{
    [JSExport]
    public static void GenericMethod<T>();    
}

As requested, it may be better to report a warning rather than an error, so that the rest of the build is not blocked. And if generic types are referenced as parameters in other non-generic APIs, they would be marshalled as external/unknown so at least the values could be round-tripped through JS back to .NET.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.