app.d.ts 887 B

123456789101112131415161718192021222324252627
  1. // D.TS files only contain type definitions, no classes or functions.
  2. // Interfaces with the same name and the same scope or namespace will just add
  3. // to each other, not conflict as long as there are no member with conflicting
  4. // types.
  5. interface Window {
  6. psExpenses: string;
  7. }
  8. type CustomDragEvent = {
  9. posX: number;
  10. posY: number;
  11. }
  12. // Intersection types. Main difference from using an interface extending Event:
  13. // the interface could be inherited later, while the type cannot (it's not a
  14. // class).
  15. type DragStartEvent = Event & { dragStart: CustomDragEvent };
  16. type DragStopEvent = Event & { dragStop: CustomDragEvent };
  17. // Interfaces are better for reusable signatures, while types aliases like those
  18. // above are better for final single-use cases.
  19. interface IDragStartEvent extends Event {
  20. dragStart: CustomDragEvent;
  21. }
  22. interface Foo extends IDragStartEvent {}