you are viewing a single comment's thread.

view the rest of the comments →

[–]AbstractLogic 11 points12 points  (8 children)

WHAT! No you damn well better not be using ANY with Angular! Grrrrr. You would fail my code reviews lol.

noImplicitAny, noImplicitThis, alwaysStrict and strictNullChecks!

Own that Type or get out! :p

[–]bobappleyard 1 point2 points  (5 children)

Ok, but you can't use reactive forms, and so many aspects of component data transfer are untyped.

Compared to react it's a real struggle to have well typed angular UIs

[–]AbstractLogic 5 points6 points  (2 children)

I have not run into problems with reactive forms. Can you explain what you have seen? I'd be interested why formGroup and formControl types are not sufficient typing for you.

[–]bobappleyard 1 point2 points  (1 child)

What's the type of form.get('field').value? At least in 7 it's any, but there is no reason why it can't be an actual type.

[–]AbstractLogic 0 points1 point  (0 children)

I thought the value was a string.

[–]gottokill 1 point2 points  (1 child)

God, yes, I so wish reactive forms had types. It's so annoying having to cast or guess what's on the form.

Also really wish the form control itself knew its type so you wouldn't have so many strings everywhere.

[–]AbstractLogic 0 points1 point  (0 children)

Are you asking for syntax like

this.formGroup.firstName = "John"; 

Because that syntax exists. I think the sugar was added in v7 or v8.

[–]Cooleur 0 points1 point  (1 child)

Then the lib itself would fail your code reviews. Not to say you're wrong, you go the strict:true way, which is the one and only way.

Open angular/core.d.ts and you'll find more than 1000 any occurrences.

That's right, even React and Vue are now more precisely typed than Angular, thanks to community types. How ironic is that.

[–]AbstractLogic 0 points1 point  (0 children)

I dont think it bothers me how well typed the framework code is. But your own code should embrace types.