Skip to Main Content
Advanced TypeScript Programming Projects
book

Advanced TypeScript Programming Projects

by Peter O'Hanlon
July 2019
Intermediate to advanced content levelIntermediate to advanced
416 pages
10h 6m
English
Packt Publishing
Content preview from Advanced TypeScript Programming Projects

Working with the database

Now that we have the ability to build the table and a representation of the state that we want to save into the table, we can turn our attention to connecting to the database and actually manipulating data in it. The first thing that we are going to do is define our class as a generic type that can work with any type that extends the RecordState class we just implemented:

export class Database<T extends RecordState> {}

The reason we need to specify the type that we accept in this class is that most of the methods in it are going to either accept instances of that type as a parameter or return instances of that type to be worked with in the calling code.

As IndexedDB has become the standard client-side database, it ...

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

Learn TypeScript 3 by Building Web Applications

Learn TypeScript 3 by Building Web Applications

Sebastien Dubois, Alexis Georges

Publisher Resources

ISBN: 9781789133042Supplemental Content