Overriding Inheritance in New Types Using Omit and Keyof in Typescript

ThankGod Ukachukwu
Published in
4 min readJul 21, 2020


Constructing Types using Index Type Query and Utility Types

Photo by Markus Spiske from Pexels

TypeScript can be weird and not very intuitive. Pardon me, I started learning TypeScript in January 2020. And JavaScript programming since 2018, almost two years. Not the little scripts we write in <script></script> with libraries like JQuery and in small files to manipulate HTML pages but JavaScript as a full fledged programming language to build libraries and code off any framework/library written in JavaScript. For everyone abreast of developments in the JavaScript world, learning TypeScript is imperative. Deno the new JavaScript and TypeScript runtime has first class support for TypeScript.

What is helping me in learning TypeScript is my knowledge of Java. Java is statically typed and that’s what TypeScript is out to achieve for JavaScript. Compile time type checking. Types and Interfaces are used to derive objects that conform to specific types. As we all know TypeScript is a turing complete programming language.

The Famous Type

Let’s cut to the chase. Here we go:

type ModelFields<T> = Partial<Omit<T, keyof BaseModel>> & {
created_at?: Date;
updated_at?: Date;