Thumbnail for video 'TypeScript Design Patterns - Adapter pattern'

← Back to courses

Adapter pattern

The adapter pattern allows you to make different classes with different interfaces work together, without changing their source code.

You can compare it to adapters in real life. Say you're traveling from the United States to Europe. If you want to charge your devices, you'll need an adapter to convert the European wall outlet to the US one. In this case the adapter should "implement" the European plug and expose a US plug for you to use.

Source code

Source code used in this video can be found on GitHub.