---
title: "Discussion on \"The Untapped Power of Interfaces in TypeScript - Create Modular Code with Interfaces\" | Hashnode"
description: "Discussion on \"The Untapped Power of Interfaces in TypeScript - Create Modular Code with Interfaces\". Most people believe that interfaces are simply \"types for objects\". What if I told you that is 100% not the purpose of interfaces?"
url: "https://hashnode.com/posts/the-untapped-power-of-interfaces-in-typescript-create-modular-code-with-interfaces/65a07e839be50869ea94d3db"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [The Untapped Power of Interfaces in TypeScript - Create Modular Code with Interfaces](https://markmaksi.hashnode.dev/the-untapped-power-of-interfaces-in-typescript-create-modular-code-with-interfaces?utm_source=hashnode&utm_medium=feed)

Most people believe that interfaces are simply "types for objects". What if I told you that is 100% not the purpose of interfaces?

Jan 11, 2024 · 5 min read · markmaksi.hashnode.dev  
Updated Jan 13, 2024  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#typescript-tutorial](https://hashnode.com/tag/typescript-tutorial)
-   [#interfaces](https://hashnode.com/tag/interfaces)
-   [#dependency-injection](https://hashnode.com/tag/dependency-injection)
-   [#nestjs](https://hashnode.com/tag/nestjs)

## Written by

[Mark Maksi](https://hashnode.com/@markmaksi)

@markmaksi · Italy

  
[View profile](https://hashnode.com/@markmaksi)

Software Engineer

Full Stack JS Engineer | Content Creator | I'm on a personal mission to provide high quality content on building web apps from code to production through my blog and my YouTube channel.

## Responses 1

Markdown supported · ⌘↵ to post

[Daniel Rodríguez Rivero](https://hashnode.com/@danielo515)

[Jan 12, 2024](https://hashnode.com/posts/the-untapped-power-of-interfaces-in-typescript-create-modular-code-with-interfaces/65a07e839be50869ea94d3db/comment/65a18884c63538b8b26fa491)

> Interfaces are specific and explicit to OOP.

Are you serious?

[Daniel Rodríguez Rivero](https://hashnode.com/@danielo515)

[Jan 14, 2024](https://hashnode.com/posts/the-untapped-power-of-interfaces-in-typescript-create-modular-code-with-interfaces/65a07e839be50869ea94d3db/comment/65a18884c63538b8b26fa491#reply-65a3b528bff466fe2ffb902e)

[Mark Maksi](https://hashnode.com/@markmaksi) because you updated your article, I am assuming you are not joking. Interfaces can, and are used in functional programming. Interfaces and classes are a nice way to group behaviours, and that is not exclusive to OOP

[Mark Maksi](https://hashnode.com/@markmaksi)

[Jan 14, 2024](https://hashnode.com/posts/the-untapped-power-of-interfaces-in-typescript-create-modular-code-with-interfaces/65a07e839be50869ea94d3db/comment/65a18884c63538b8b26fa491#reply-65a3b80e54f1206b72e48948)

[Daniel Rodríguez Rivero](https://hashnode.com/@danielo515) I updated the post because I don’t want my readers to think that interfaces are exclusive to TypeScript.

How can Interfaxes be used in functional programming other than defining types for objects? Can you show me an example in a code snippet?

[Daniel Rodríguez Rivero](https://hashnode.com/@danielo515)

[Jan 15, 2024](https://hashnode.com/posts/the-untapped-power-of-interfaces-in-typescript-create-modular-code-with-interfaces/65a07e839be50869ea94d3db/comment/65a18884c63538b8b26fa491#reply-65a4dcace0bc534a22d4cc9d)

[Mark Maksi](https://hashnode.com/@markmaksi) interfaces allow some type definitions that are not possible in plain types. Not sure what is in your mind, but ojects and classes are not exclusive to OOP. In FP classes can be used to model/group behaviour, without attaching any data to it. Option, Either are defined using interfaces that any class can implement. Here you have an example: [github.com/gcanti/fp-ts/blob/master/src/Option.ts](https://github.com/gcanti/fp-ts/blob/master/src/Option.ts)
