0

I'm not sure where to check, but I have a nodejs/TS folder that builds correctly on my laptop, but fails on my desktop. The code is:

        const result: GetResourceXHR = {
            ...p,
            done( s: ajaxGetResourceSuccessCallbackSpread ) {
                p.done(function (...args) {
                    // s.call(p, ...args, resourceResult);
                    s.call(p, args[ 0 ], args[ 1 ], args[ 2 ], resourceResult);
                });
                return result;
            }
        };

And my callback interface is:

// Because this uses spread operator, all params have to be optional... https://stackoverflow.com/a/46228488/166231
interface ajaxGetResourceSuccessCallbackSpread {
    ( data?: any, textStatus?: string, jqXHR?: JQuery.jqXHR, resource?: KatAppResourceResult ): void;
}

On my laptop, I can use: s.call(p, ...args, resourceResult);

But on my desktop, I get the error:

error TS2345: Argument of type 'KatAppResourceResult' is not assignable to parameter of type 'string'.

That is why above I have changed it to: s.call(p, args[ 0 ], args[ 1 ], args[ 2 ], resourceResult);

Both machines have: Visual Studio Code: 1.53.2 Typescript: 4.1.5

I would like to continue to just use the spread syntax, but more importantly, I want to figure out why it is building differently. As additional note, I copied entire folder from my laptop and opened it on my desktop and received the same error. I don't know if this helps, but I wasn't sure if some of the underlying nodejs libraries were different or what.

Terry
  • 2,148
  • 2
  • 32
  • 53

0 Answers0