Announcement

Collapse
No announcement yet.

[CLOSED] Can I use retyped to compile my own d.ts files?

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

    [CLOSED] Can I use retyped to compile my own d.ts files?

    Retyped is great! Is it possible to use retyped to compile my own d.ts files? If yes how?

    And:

    kendo-ui from Telerik is included in DefinitelyTyped but not in Retyped? Is this by intention or will it be included in the future?
    (https://github.com/DefinitelyTyped/D...types/kendo-ui)

    P.S.: You did a very good job with Retyped !!! I like it !!!

    #2
    Hi Markus,

    Thanks for your interest and warm words about Retyped.

    Compilation of custom d.ts files is not publicly available now. I'd recommend submitting them into DefinitelyTyped repository, that would make Retyped able to grab them and compile in the same way it's done for existing declarations. If your d.ts are private and not supposed to be exposed to public, you can send an email to hello@object.net and we can discuss some options.

    As for kendo-ui, confirming that the library is still not published. That could happen due to errors in the d.ts or it just contains some specific syntax that is not supported by Retyped yet. Our main goal is to publish all libraries available in DefinitelyTyped repository, so there is no intention to exclude kendo-ui and I believe Retyped package would be available soon. I've created an issue, so you can track the progress:
    https://github.com/Retyped/Retyped/issues/12

    Comment


      #3
      Hello Andrey

      thanks for the quick answer! Background of my questions was all about Kendo-ui.

      Yesterday I startet to write all the jquery extentions needed to use kendo-ui in bridge.net - and now there is Retyped - perfect timing - and I thought I can stopp this work. But - because kendo-ui was not included, I was thinking of compiling it by myselfe...

      Comment


        #4
        Hi Markus – We're investigating why Kendo UI is not available in Retyped. We should have an answer soon.

        Comment


          #5
          Hi Markus ,

          The package for kendo-ui library has been created, now it's available on NuGet.org:
          https://retyped.com/?q=kendo#search
          https://www.nuget.org/packages/Retyped.kendo-ui/

          Let us know if you have any questions.

          Comment


            #6
            Hello Andrey and geoffrey.mcgill,

            great great great! Thanks a lot!!!

            The only thing left: I don't know how to use it. I can not find the jQuery Selector Function... (I had already the same problem with Retyped.jQuery yesterday)

            With Bridge.jQuery and my own kendoUI Extentions is used to write:

            Bridge.jQuery2.jQuery.Select("#button1").kendoButton(new KendoButtonOptions{...});
            How to write this with Retyped.jQuery or kendo_ui.JQuery. I just can not find the jQuery Select function there...

            Comment


              #7
              For Retyped.jquery, you can use jQuery.select("#btn");. That will compile to jQuery("#btn");. The Deck below demonstrates a simple scenario. I haven't tested Kendo yet, so I'm not sure if .select() will chain with the kendoButton call.

              https://deck.net/17f3a27ee4ba1f8c0b9439192b8f6d99

              using static Retyped.dom;
              using static Retyped.jquery;
              
              public class App
              {
                  public static void Main()
                  {
                      var btn = new HTMLButtonElement
                      {
                          id = "btn",
                          innerHTML = "Submit"
                      };
              
                      document.body.appendChild(btn);
              
                      // Button will slowly fade out
                      jQuery.select("#btn").fadeOut(5000);
                  }
              }
              Hope this helps.

              Comment


                #8
                Thanks again! Retyped jQuery is working now.
                (I trusted to much on intellisence and for some reason the select(string...) did not show up. But just typing it works.)

                kendoButton is not chaning up with the select of jQuery. In JavaScript it does like this:

                $("#button1").kendoButton();
                Object Explorer is showing me for the Retyped.Keno-ui package:
                • Retyped.kendo_ui.JQuery kendoButton(Retyped.kendo_ui.kendo.ui.ButtonOption s.Interface options)
                • Member of Retyped.kendo_ui.JQuery
                But this is only an interface definition. How to use it?

                P.S.: All the static methods of kendoUI are working perfectly!!!

                Comment


                  #9
                  If I write a little extention everything is working great

                  using Bridge;
                  using Retyped;
                  // ReSharper disable InconsistentNaming
                  
                  namespace cleverDev.Bridge.WebUI.Extentions.KendoUI {
                      [External]
                      public static class KendoUiButtonExtentions {
                          public static jquery.JQuery.Interface kendoButton(this jquery.JQuery.Interface jQuery) {
                              return null;
                          }
                          public static jquery.JQuery.Interface kendoButton(this jquery.JQuery.Interface jQuery, kendo_ui.kendo.ui.ButtonOptions options) {
                              return null;
                          }
                      }
                  }
                  I can use it in C# code like this:

                  Retyped.jquery.jQuery.select("#menuButton1").kendoButton(new kendo_ui.kendo.ui.ButtonOptions {...});

                  Comment


                    #10
                    Hi Markus ,

                    Thanks for the update. Your approach with KendoUiButtonExtensions looks very good.

                    Actually it's a good sample of entities augmentation implemented in TypeScript: one library declares an entity (in our case it's jQuery interface), and another library augments that entity with new members (kendo-ui also declares jQuery interface with additional set of members such as kendoButton() functions). Speaking in terms of C#, augmentation can be implemented with C# extensions. Unfortunately, not all scenarios could be supported with that approach (e.g. augmentation of static side of a class, or just properties). We look forward to the upcoming C# feature that would help a lot - Language Feature: Extension Everything.

                    Anyways augmentation is important part of TypeScript declarations, and Retyped already handles different scenarios like augmentation within a single assembly, but there are still a few cases that require our attention and they are one of our major goals.

                    Comment


                      #11
                      Hi Markus,

                      I'd like to share that Retyped now supports extensions. It automatically identifies extended entities and performs two actions:

                      1. Adds a reference to the extended type into a base list (that illuminates a problem of casting extension back to the original type).
                      2. Generates a class with extension methods for all identified types. The class is located under *Retyped* namespace.

                      More information can be found here.
                      Below is the updated sample for kendoButton:

                      jQuery.select("#button1").kendo_ui().kendoButton(new kendo.ui.ButtonOptions {...});

                      Comment

                      Working...
                      X