canhorn / EventHorizon.Blazor.TypeScript.Interop.Generator

This project is a Blazor Interop C# Generator, has a sample against the BabylonJS library.
https://wonderful-pond-05f7b3b10.azurestaticapps.net/
MIT License
132 stars 19 forks source link

Numerous methods for classes not being generated #67

Open nickj886 opened 2 years ago

nickj886 commented 2 years ago

Hi @canhorn

As a Blazor developer and having an interest in the BabylonJs engine I really like what you have done here bringing the two together.

I have noticed thou that your tool is not generating a number of methods like createDefaultEnvironment and createDefaultXRExperienceAsync which are defined in Scene interfaces instead of the actual Scene class definition. Would it be possible to include the public members of those interfaces as well?

Also I have noticed there are some private properties in the babylon.d.ts, such as TmpVector3, that are not defined properly and so are being generated incorrectly in the C# output. For this issue I did add a quick fix locally (see below) to get past it. Do you think it is reasonable to ignore any child nodes that are private as they are internal to the BabylonJS engine and likely shouldn't be accessible via the interop?

private static bool IsNotPrivate(Node child)
        {
            if (child.Modifiers?.Any(modifier => modifier.Kind == SyntaxKind.PrivateKeyword) ?? false)
                return false;

            return child.Modifiers?.Count(
                modifier => modifier.Kind == SyntaxKind.PrivateKeyword) == 0
            && child.Modifiers?.Count(
                modifier => modifier.Kind == SyntaxKind.ProtectedKeyword) == 0
            && child.IdentifierStr != null && !child.IdentifierStr.StartsWith("_");
        }

If the change is acceptable I can add it via a pull request.

Regards Nick