tom10271
tom10271

Reputation: 4657

How to create object with type alias in TypeScript?

new BaseListState<BrandCriteria, Brand>()

This is working and I add

export type BrandListState = BaseListState<BrandCriteria, Brand>;

then

new BrandListState()

This is not allowed. Any way to fix this problem?

Upvotes: 8

Views: 1934

Answers (1)

Damian Plewa
Damian Plewa

Reputation: 1193

You're using a Type Alias (see doco here) which doesn't have constructor, so it can't be created with new. You need to create class for this

class BrandListState extends BaseListState<BrandCriteria, Brand> {}

Upvotes: 6

Related Questions