Skip to Main Content
Mastering TypeScript 3 - Third Edition
book

Mastering TypeScript 3 - Third Edition

by Nathan Rozentals
February 2019
Beginner content levelBeginner
694 pages
18h 4m
English
Packt Publishing
Content preview from Mastering TypeScript 3 - Third Edition

Service Location

Our current implementation of the MailService class relies on the calling code to create an instance of the ISystemSettings interface, and pass this through in the constructor. When we write code that creates an instance of the MailService class, we are therefore forced to provide the ISystemSettings interface at the time of construction. This is a compile-time dependency. In other words, changing the instance of ISystemSettings requires changes to the source code, and then recompilation. It would be far better, however, if we set these options at runtime.

In order to accomplish this, the MailService class needs to request an instance of the class that is implementing the ISystemSettings interface at runtime, not at compile ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The TypeScript Workshop

The TypeScript Workshop

Ben Grynhaus, Jordan Hudgens, Rayon Hunte, Matt Morgan, Wekoslav Stefanovski

Publisher Resources

ISBN: 9781789536706Supplemental Content