No announcement yet.

[CLOSED] Retyped - How to ? (a few examples) ?

  • Filter
  • Time
  • Show
Clear All
new posts

    [CLOSED] Retyped - How to ? (a few examples) ?

    Are there any example on how to use sweetalert and ej.web.all ?

    Steps so far.

    1) Bridge.Net installed
    2) Bridge Class library project created
    3) install-package retyped
    4) install-package sweetalert
    5) Add using statements

    using Retyped;
    using static Retyped.sweetalert;

    Now ??

    In VS2017 I get dropdown's with swal, sweetAlert, sweetalert, sweetalert2

    swal -> SweetAlert.SweetAlertStatic.Interface sweetalert.swal { get; set }
    sweetAlert -> SweetAlert.SweetAlertStatic.Interface sweetalert.sweetAlert { get; set }
    SweetAlert -> class Retyped.sweetalert.SweetAlert
    sweetalert -> class Retyped.sweetalert
    sweetalert2 -> class Retyped.sweetalert.sweetalert2

    What hints should one look for when using retyped wrappers ?


    I was able to get swal working with the following configuration.

    using static Retyped.sweetalert;
    namespace Demo
        public class Program
            public static void Main()
                swal.Self("Oops", "Something went wrong");
    Hope this helps.


      Thanks.. Yes works well.

      There are 7 methods for swal, some of which have Union/Intersections etc (see below):

      swal.Self("Oops","Something went wrong", ????)
      The 3rd param is: Union<SweetAlert.AlertType, SweetAlert.PromtType> type

      or when you have:

      swal.Self(Intersection<SweetAlert.Settings, SweetAlert.PromtModalSettings> settings, SweetAlert.SweetAlertStatic.SelfFn2 callback);

      swal.Self(Intersection<SweetAlert.Settings, SwetAlert.PromtModalSettings> settings);
      Hand converts previously used ENUMs for success/error/warning etc.

      The Retyped uses Unions/Intersections of Classes?

      Thanks for the help, just unsure which way to proceed when callbacks/unions/intersections are params.
      Last edited by geoffrey.mcgill; 2017-10-11 @ 03:38 AM.


        The type overload can be accomplished with the following, but it's certainly not a clean as I would have hoped.

        swal.Self("Oops", "Something went wrong", Literals.error.As<SweetAlert.PromtType>());
        I think we should be able to improve Retyped to enable some cleaner syntax options.

        Usage sample for the Settings and Callback overloads are a bit of a mystery to me at the moment. We'll figure this out and come up with some solutions.

        The following Edge Cases string literal vs Enum description might be helpful for explaining why enums cannot be used in C# to define string literals from TypeScript.


          Thanks.. That works well.

          As for string vs Enum, ahhh yes.. See that now.

          Callbacks/Settings is the next area I'm playing in..

          Then onto trying ej.web.all for Syncfusion support.


            Hi CastleSoft ,

            Please take a look at a simple demo project we composed for SweetAlert JS.
            Make sure you're referencing the correct version of SweetAlert library (the one specified in the .d.ts - 1.1.3).

            Live Demo:

            Hope this helps.
            Last edited by geoffrey.mcgill; 2017-11-12 @ 07:37 AM.


              Thanks.. Works perfectly..!

              Greatly appreciated..