Skip to content


 Zabbix
 Grafana
 Prometheus
 React Three Fiber
 Threejs and TypeScript
 SocketIO and TypeScript
 Blender Topological Earth
 Sweet Home 3D
 Design Patterns Python
 Design Patterns TypeScript
   
 Course Coupon Codes
Three.js and TypeScript
Kindle Edition
$6.99 $9.99 Paperback 
$22.99 $29.99




Design Patterns in TypeScript
Kindle Edition
$6.99 $9.99 Paperback
$11.99 $19.99




Design Patterns in Python
Kindle Edition
$6.99 $9.99 Paperback
$11.99 $19.99




Interfaces and Type Declarations

Video Lecture

Interfaces and Type Declarations Interfaces and Type Declarations

Description

In TypeScript, Interfaces and Type declarations offer almost the same exact functionality, in this video we explore that idea.

An Interface/Type is a structure used for type-checking.

An Interface/Type defines the properties and types an object can have.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
interface Quux {
    quuz: string
    corge: number
}

function foo(bar: Quux) {
    return 'Hello, ' + bar.quuz + ' ' + bar.corge
}

let baz: Quux = { quuz: 'ABC', corge: 123 }

console.log(foo(baz))

Try it,

tsc foo.ts
node foo.js