S
S
Sergey Zolotarev2021-08-30 14:52:28
typescript
Sergey Zolotarev, 2021-08-30 14:52:28

How to make classes with support for interfaces without errors?

Good afternoon!
I recently encountered that there are few errors in a class whose methods interact with typed interfaces, and the interfaces themselves are built without errors:

export interface IHandlerControl{
    screenEvent: string
    eventType: number
}
export interface IServiceControl{
    svc: string,
    query: any
}


The actual code for the class I'm talking about will be available in the comments for you to study, and I'll ask you the question:
How do I fix errors thrown by the TypeScript compiler while still creating this kind of class correctly?
612cc64a4634d980386103.png
But I will warn you that I am still new to TypeScript!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuriy Vorobyov, 2021-08-30
@YuriyVorobyov1333

You have errors in the code, for example, here you are assigning an interface as a value, and not designating it as a type
this.storesFeed = IHandlerControl = {...}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question