Announcement

Collapse
No announcement yet.

Is there an automatic Definition Library builder?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there an automatic Definition Library builder?

    There is a great description of how to build a Definition Library here https://github.com/bridgedotnet/Brid...nition-library. After reading it, it came to my mind that building Definition Library can be automatic. Technically, I don't see reasons why not. A tool can parse js file and create the C# Definition Library using particular rules. I wonder if such tool already exists. If not, are there plans to create one?

  • #2
    Hello. Thanks for the suggestion. This idea has been brought up a few times, and it's something we're looking into, but it is not a simple task.

    https://github.com/bridgedotnet/Bridge/issues/2219

    Comment


    • #3
      I see... By the way, referred issue is talking about building definitions by the TypeScript files which most likely should be easier than building it by JavaScript files but I'm sure if it actually will come to writing such a tool JavaScript -> C# definition is much more useful than TypeScript -> C# definition. After all, there are many companies sharing JavaScript APIs which need to be consumed. TypeScript is a different story. I guess building definitions by TypeScripts are necessary for internal project conversions. I would more worry about 3rd party APIs and probably it should not be too difficult. Such APIs usually follow certain rules which will simplify definition building.

      Comment


      • #4
        Hi alex4998,

        Converting from TypeScript declaration files to C# (Bridge) seems like it would be possible, albeit very difficult. Creating a generic enough solution for converting from original JavaScript source files into C# seems impossible.

        To the best of my knowledge, nobody has developed an app to reliably convert from .js into .d.ts. Mostly because it's impossible to determine types. I think you can get a start by using dts-gen from Microsoft, but they even state your .d.ts will be full of any types.
        Last edited by geoffrey.mcgill; 2017-03-13 @ 06:54 AM.

        Comment

        Working...
        X