0

I have the following code with delegate:

 $.ajax(this.validateURL, {
        type: "post",
        url: this.validateURL,
        data: JSON.stringify(data),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {
            solicitacion.procedure.set("GenarateSample", true);
            if (!response.Success) {
                notification.Show(response.Message, NotificationType.Error);
                return false;
            } else {
                if (response.Message.length > 3) {
                    this.confirm(solicitacion);
                } else {
                    this.adicionarprocedureNaGrid(solicitacion, false);
                }
                return true;
           }
        },
        error: e => {
            error_handler(e);
        }
    }); 
After minification:

<pre> $.ajax(this.validateURL, {
    type: "post",
    url: this.validateURL,
    data: JSON.stringify(i),
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: i => t.procedure.set("GenarateSample", !0),
    i.Success? (i.Message.length > 3 ? this.confirmarprocedure(t) : this.adicionarprocedureNaGrid(t, !1), !0) : (n.Show(i.Message, NotificationType.Error), !1),
    error: n => {
        error_handler(n)
    }
}) </pre>

Whitout delegate, minification is correct:

    $.ajax(this.validateURL, {
        type: "post",
        url: this.validateURL,
        data: JSON.stringify(i),
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (i) {
            return t.procedure.set("GenarateSample", !0),
                i.Success? (i.Message.length > 3 ? this.confirmarprocedure(t) : this.adicionarprocedureNaGrid(t, !1), !0) : (n.Show(i.Message, NotificationType.Error), !1)
        },
        error: n => {
            error_handler(n)
        }
    }) 
1
  • 1
    you mean arrow function ? it's not supported in ES2015 . you need a transpiler for that Commented Oct 5, 2017 at 14:37

1 Answer 1

0

You need to perform the minification after the TypeScript compiler has done its work.

TypeScript File (.ts)

const a = (y: string) => {
    return y;
}

const b = function (y: string) {
    return y;
}

Compiles to JavaScript (.js)

var a = function (y) {
    return y;
};
var b = function (y) {
    return y;
};

So minify the compiled JavaScript, not the TypeScript source file and it will work.

Sign up to request clarification or add additional context in comments.

1 Comment

I'm going to test, modifying to something similar with indicated

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.