-1

What is the usage of declare class?whereas we can remove declare word???

 export declare class DialogContentBase {
        dialogTitleBar: DialogTitleBarComponent;
    }

As we can simply define the class like this:

 export class DialogContentBase {
        dialogTitleBar: DialogTitleBarComponent;
    }

1 Answers1

1

Declare is used for defining interfaces for code that comes from outside your codebase: https://dzone.com/articles/quick-tip-%E2%80%93-typescript-declare

e.g.

If you include globally a library from somewhere outside your codebase and you want to use it (you put it in index.html for example) you can use declare to declare the typings for it.

You should not use it in your usecase.

tudor.gergely
  • 4,800
  • 1
  • 16
  • 22