Fixing typescript error: Overload signatures must all be ambient or non-ambient.

../../../usr/local/lib/node_modules/typescript/lib/lib.d.ts(16893,18): 
error TS2394: Overload signature is not compatible with function implementation.

index.tsx(3,10): error TS2384: 

Overload signatures must all be ambient or non-ambient.

For instance, you can cause it with just this:

function print(x: String) { 
}

This is an indication that you’re creating a function that overloads another function, but the other one doesn’t have types. The correct fix is to rename your item.

Interested in JavaScript? I send out weekly, personalized emails with articles and conference talks. Click here to see an example and subscribe.

2 replies
  1. Abelardo
    Abelardo says:

    Hi,
    Thanks but I didn’t get the point.

    An example:
    Message: lib/adjuntar.v1.0.1.ts(3,10): error TS2384: Overload signatures must all be ambient or non-ambient.

    line#3: function previsualizaFile(input) {
    //Also, I tried with: function previsualizaFile(input: any) {

    declare function previsualizaFile(input: any): void;

    So, where the error is?
    I didn’t understand your explanation, may you explain it again with another example, please?

    Any help would be welcome.
    Best regards,

    Reply
  2. Abelardo
    Abelardo says:

    Hi,
    I renamed my functions but it didn’t work for me.

    May another approach be to solve this issue?

    Thanks for the tip but it didn’t help me!

    Best regards.

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *