Skip to main content

Interfaces

Less than 1 minute

Interfaces

  • Interfaces don't exist in JavaScript
  • But we can use their power in TypeScript

Example

interface Point {
    x: number; y: number;
}

class MyPoint implements Point {
    x: number; y: number; 
}
  • Compiled to JavaScript:
class MyPoint {
    x;
    y;
}