DEV Community

Discussion on: Small Project Reflection: React, TypeScript and PokéAPI

Collapse
 
chiangs profile image
Stephen Chiang

Hi Nina,

With TypeScript, there's a lot of benefits in using the interface for type checking.

You could create the interface for type checking, then export it from an interfaces file or it's own file. Then in the components you need it, you can import the interface as a type.

Also, interfaces are used for type checking at compile time, but then thrown away at build time so it doesn't bloat your app size which make great replacements for object classes often only instantiated to type check the shape of a data object.

Collapse
 
misnina profile image
Nina

Thanks for the tips!