The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Using Interfaces to Describe Types in TypeScript

Using Interfaces to Describe Types in TypeScript

3:32
It’s easy to pass the wrong value to a function. Typescript interfaces are great because they catch errors at compile time or in an IDE. In this lesson we’ll learn how to describe a type shape with Typescript interfaces.
Watch this lesson now
Avatar
egghead.io

It’s easy to pass the wrong value to a function. Typescript interfaces are great because they catch errors at compile time or in an IDE. In this lesson we’ll learn how to describe a type shape with Typescript interfaces.

Avatar
Oktay

Great clean voice! Great Tutorial anyway! I WANT MORE!

Avatar
Ari

Thanks Oktay! Glad you enjoyed the video. This totally made my day.

In reply to Oktay
Avatar
Sports

I seem to be getting: Error:(..., ...) TS2683:'this' implicitly has type 'any' because it does not have a type annotation.. :/

Avatar
Sports

Interesting, so if I do:

let attackFunc = function(this: any, opponent: any, attackWith: any) {

it works!
But if I try to do it in ES syntax:

let attackFunc = (this: any, opponent: any, attackWith: any) => {

it doesn't, still throws the same error. :/

In reply to Sports
Avatar
Ari

I think you figured it out, but if you're still wondering this isn't allowed as an arrow function argument.
Here's a reference to the issue on Github.

In reply to Sports
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?