Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What does the "=" do in “`export class NgForOfContext<T, U extends NgIterable<T> = NgIterable<T>> {“`

I was looking at the source for ngForOf in Angular and I came across this line:

export class NgForOfContext<T, U extends NgIterable<T> = NgIterable<T>> {

see: https://github.com/angular/angular/blob/master/packages/common/src/directives/ng_for_of.ts#L14

I played around with the = operator and changed it to & and |. However, even with the typescript docs I couldn’t figure out what the = operator actually does.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Kind Regards

>Solution :

If you don’t pass anything to U, then U will fall back to NgIterable<T> as a default value.

See docs

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading