facebook

No type in *ngFor for iterable interface in template validator / autocomplete

  1. CodeMix & Angular IDE
  2.  > 
  3. Webclipse 1.x Help
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #545255 Reply

    Fedor Losev
    Participant

    Example:

    When we have

    
    test: { a: string }[];
    

    in class and in template

    
    <button *ngFor="let item of test" >
    {{item}}
     </button>
    

    the item is properly typed and autocomplete shows available members, e.g. item.a. It also properly shows ‘not defined’ errors e.g. for item.b.

    However, if we have

    
    test: ReadonlyArray<{ a: string }>;
    

    in class, there is no autocomplete for available members, e.g. item.a. Much worse, item.b silently passes validation, seems that the type information is lost and the item interpreted as ‘any’.

    Note, outside of ngfor test itself is properly typed even in second case and shows autocomplete members and validation errors for {{test[0].x}}.

    #545352 Reply

    support-swapna
    Moderator

    Fedor,

    Thank you for the detailed report. I could replicate the validation problem at my end. A bug is filed for the dev team to work on it. We will keep you posted about the fix details.

    Apologies for inconvenience caused.

    –Swapna
    MyEclipse Support

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: No type in *ngFor for iterable interface in template validator / autocomplete

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in