0

loadingOverlay below acts as both a function and an object that contains another function called 'close'. How would this be declared in a Typescript definition file?

USAGE
$.cmp.loadingOverlay("Please wait...");
$.cmp.loadingOverlay.close("Please wait...");

DECLARATIONS
$.cmd.loadingOverlay = function(message) { ... }
$.cmd.loadingOverlay.close = function(message) { ... }

Declaring loadingOverlay just as a function was pretty straight forward but I cannot figure out how to add the close method.

interface JQueryStatic {
    cmp: {
        loadingOverlay(message: string): JQuery;
    }
}

Thanks

1 Answer 1

3
interface JQueryStatic {
  cmp: {
    loadingOverlay: {
      (message: string): JQuery;
      close(message: string): void;
    }
  }
}
Sign up to request clarification or add additional context in comments.

1 Comment

I knew it would make sense when I saw the answer. Thank you.

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.