Comments (2)
If you change new FormGroup(...)
to new FormGroup<T>(...)
you'll get
Argument of type '{ codipostalMercaderies_input: FormControl<string>; katr10_input: FormControl<boolean>; nomMercaderies_input: FormControl<string>; poblacioMercaderies_input: FormControl<...>; ... 20 more ...; pais_input: FormControl<...>; }' is not assignable to parameter of type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to '{ codipostalMercaderies_input: FormControl<string>; katr10_input: FormControl<boolean>; nomMercaderies_input: FormControl<string>; poblacioMercaderies_input: FormControl<...>; ... 20 more ...; pais_input: FormControl<...>; }'.
which exposes a real problem with this code, unrelated to the typings of @angular/forms
: T
may require additional properties that are not present in the FormGroup
's controls object.
The error message isn't great here due to @angular/forms
's complexity to support typed forms in a backwards compatible way, but it's fundamentally an issue with your code.
from angular.
As @JoostK explains, he type error is a bit hard to parse here, but is correct.
parent
declares a generic type T
with the bound of extends iZmerControls
. This type could be iZmerControls
, or it could be some type which extends iZmerControls
and adds extra controls. For example:
interface MyControls extends iZmerControls {
someName: FormControl<number>;
}
new parent<MyControls>();
What TypeScript is telling you is that new FormGroup({...})
in parent
can't be proven to satisfy T
, since it might be missing controls which are present in the extended T
. For example, it would be missing someName
in the case of new parent<MyControls>
above.
from angular.
Related Issues (20)
- Output Signal works, but parent says event is not emitted... HOT 2
- Pipes doc not loading when opening it in angular.dev https://angular.dev/api/common#pipes HOT 1
- Scrolling on angular.dev API reference page is not working well HOT 2
- Angular DevTools not available - Firefox Developer Edition HOT 8
- No link to sources from reference documentation on angular.dev HOT 1
- Uncaught Error: ASSERTION ERROR: NodeInjector must have some connection to the module injector tree HOT 4
- Angular new website is down! HOT 5
- Conflicting Press Kit Guidelines in angular.dev Documentation
- Typescript 'user' is possibly 'undefined' Error in angular-compiler HOT 3
- [$injector:unpr] Unknown provider: translateFilterProvider <- translateFilter HOT 2
- docs: Confusing information on Angular Elements guide page
- Possible Bug - Type Narrowing works with Strings (Class and Template), but not with Enums (only works in Class, but not Template) HOT 8
- Support Ticket Test
- Page Not Found 🙃 HOT 2
- https://angular.dev/assets/tutorials/common leads to a 404 page HOT 2
- Add "transform" to model() HOT 8
- docs: 404 in i18n documentation HOT 1
- docs: code example missing in PercentPipe documentation page HOT 1
- docs: 404 in i18n guide (`$localize` API is missing) HOT 4
- Expected to be in Angular Zone, but it is not HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular.