0
There is the following variable declared in the script:
private profile: Profile;
See that it is a variable of type Profile
.
When trying to assign a value to the variable, returns the following error:
Property 'Collection' does not exist on type 'Profile'.
The value being assigned is as follows:
this.profile = response.collection;
Meanwhile I found that the property response.collection
is an instance of the class Profile
:
console.log(response.collection instanceof Profile);
//true
Why the variable profile
does not accept the value of response.collection
where it is an instance of the class Profile
?
like the
response
is tipado?– mercador
and please use the correct tag. Typescript is not used in Angularjs
– mercador
@merchant regarding the tag was lapse on my part. Regarding typing I added the ":any" and it started to work, but I don’t understand the need to define the type for Sponse.
– Filipe Moraes
by the error message it seems to me that before Sponse was typed as
Profile
– mercador
@merchant the
response
no, but theresponse.collection
yes, it is an instance of the classProfile
.– Filipe Moraes