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