The keyword extends can be used for interfaces and classes only.

If you just want to declare a type that has additional properties, you can use intersection type:

type UserEvent = Event & {UserId: string}

UPDATE for TypeScript 2.2, it's now possible to have an interface that extends object-like type, if the type satisfies some restrictions:

type Event = {
   name: string;
   dateCreated: string;
   type: string;
}

interface UserEvent extends Event {
   UserId: string; 
}

It does not work the other way round - UserEvent must be declared as interface, not a type if you want to use extends syntax.

And it's still impossible to use extend with arbitrary types - for example, it does not work if Event is a type parameter without any constraints.

Answer from artem on Stack Overflow
🌐
TypeScript
typescriptlang.org › docs › handbook › 2 › objects.html
TypeScript: Documentation - Object Types
For example, we might have a BasicAddress type that describes the fields necessary for sending letters and packages in the U.S. ... In some situations that’s enough, but addresses often have a unit number associated with them if the building at an address has multiple units. We can then describe an AddressWithUnit. ... This does the job, but the downside here is that we had to repeat all the other fields from BasicAddress when our changes were purely additive. Instead, we can extend the original BasicAddress type and just add the new fields that are unique to AddressWithUnit.
🌐
DEV Community
dev.to › tomoy › three-ways-of-using-extends-in-typescript-3dld
Three Ways of Using "extends" in TypeScript - DEV Community
May 4, 2024 - In the above example code, the extends keyword works to constrain the type of the generic, K. In other words, one of the keys of T is chosen for K instead of allowing any keys to be the type of the key argument. Thus, the function can be limited to only one return type instead of a union type. TypeScript has the capability of making a logic to dynamically generate a type according to a type assigned to a generic.
🌐
Jelani Harris
jelaniharris.com › blog › how-to-extend-types-in-typescript
How to extend types in Typescript | Jelani Harris
September 16, 2023 - type Animal = { name: string; ... PredatorAnimal = Animal & Creature; We can extend interfaces in Typescript by using the extends keyword....
🌐
Graphite
graphite.com › guides › extending-types-typescript
Extending types in TypeScript - Graphite
Type extension is the process of taking an existing type and creating a new type that adds new properties, modifies existing ones, or both. This allows you to specialize a base type for use in different contexts.
🌐
DEV Community
dev.to › wojciechmatuszewski › extending-various-typescript-type-declarations-36km
Extending various TypeScript type declarations - DEV Community
January 22, 2022 - How to extend various TypeScript type declarations - a field guide. Tagged with typescript, react, node, webdev.
Find elsewhere
🌐
Convex
convex.dev › core concepts › object-oriented programming (oop) › extends
Extends | TypeScript Guide by Convex
Interface extension composes complex types from simpler ones. Generic constraints ensure type parameters meet specific requirements. And conditional types? They let your types adapt based on input. Understanding when and how to use extends in each scenario is key to mastering TypeScript's type system.
🌐
TypeScript Book
gibbok.github.io › typescript-book › book › extending-types
Extending Types | TypeScript Book
TypeScript Book · Search · Cancel ... } interface B { b: string; } interface Y extends A, B { y: string; } The extends keyword works only on interfaces and classes, for types use an intersection: type A = { a: number; }; type B = { b: number; }; type C = A & B; It is possible ...
🌐
LogRocket
blog.logrocket.com › home › extending object-like types with interfaces in typescript
Extending object-like types with interfaces in TypeScript - LogRocket Blog
June 4, 2024 - We can apply the same pattern to other entity types (e.g., Author, Publisher) by creating similar repository classes with different type parameters. Generic constraints in TypeScript restrict the types that can be used with a generic parameter to ensure they have specific properties or characteristics. In the above example, let’s assume we want to ensure that T must have an id property. Here’s how we can apply a generic constraint. We update the Repository interface to include a generic constraint <T extends EntityWithId>. This constraint ensures that T must be a type that has an ID property:
🌐
GeeksforGeeks
geeksforgeeks.org › typescript › typescript-object-extending-types
TypeScript Object Extending Types - GeeksforGeeks
August 9, 2024 - TypeScript Object Extending Types refers to the ability to create new object types or interfaces that inherit properties and methods from existing ones using the extends keyword. This allows developers to build more complex, reusable, and ...
🌐
TypeScript Tutorial
typescripttutorial.net › home › typescript tutorial › how to extend interfaces in typescript
TypeScript Extend Interface
August 10, 2023 - In this example, the interface D extends the interfaces B and C. So D has all the methods of B and C interfaces, which are a(), b(), and c() methods. TypeScript allows an interface to extend a class. In this case, the interface inherits the properties and methods of the class.
🌐
Medium
medium.com › @umefy › advanced-typescript-extending-different-types-and-overriding-properties-cc6c6d8d847b
Advanced TypeScript: Extending Different Types and Overriding Properties | by Umefy | Medium
January 4, 2024 - TypeScript allows for the extension of types using various methods, including intersection types and utility types. This is particularly useful when dealing with complex data structures or when integrating different modules.
🌐
Convex
convex.dev › core concepts › object-oriented programming (oop) › extend interface
Extend Interface | TypeScript Guide by Convex
This guide covers practical extension ... day in real applications. To add new properties to an interface in TypeScript, use the extends keyword:...
🌐
Bobby Hadz
bobbyhadz.com › blog › typescript-extend-type
How to extend a Type in TypeScript | bobbyhadz
February 26, 2024 - Use an intersection type to extend a type in TypeScript. Intersection types are defined using an ampersand `&`.
🌐
EDUCBA
educba.com › home › software development › software development tutorials › typescript tutorial › typescript extend type
TypeScript Extend Type | How does TypeScript Extend Type work?
February 17, 2023 - TypeScript extend type is defined as the typescript interfaces that can extend classes which means that the interfaces can take over the members of a class but without an execution in which the class behaves as an interface that can have all ...
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Webtips
webtips.dev › solutions › extending-types-in-typescript
Extending Types in TypeScript The Right Way - Webtips
January 5, 2023 - Extending types in TypeScript can be done by using the & operator. This is called intersection types, which can be used for combining two or more different types together. ... // ✔️ Using different types type Fruit = { sweet: boolean } type ...
🌐
Damir's Corner
damirscorner.com › blog › posts › 20200911-ExtendingTypescriptTypeDefinitions.html
Extending TypeScript Type Definitions | Damir's Corner
September 11, 2020 - A TypeScript type definition can be extended in a different type definition file by declaring a module matching the original location of the type definition (vue/types/vue matches the vue.d.ts file in the types folder of the vue NPM package).