interface

interface sözde öğesi, tip objeleri oluşturmanın başka bir yoludur. Aşağıda fonksiyonlar ve objelerde kullanımı örneklendirilmiştir.

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

function printCoord(pt: Point) {
  console.log("The coordinate's x value is " + pt.x);
  console.log("The coordinate's y value is " + pt.y);
}

printCoord({ x: 100, y: 100 });
interface Teams {
    turkey: 'fenerbahce' | 'galatasaray',
    spain: 'barcelona' | 'real-madrid'
}

let champions: Teams = {turkey: "fenerbahce", spain: "barcelona"}

Last updated