How to resolve 'Property 'foo' has no initializer and is not definitely assigned in the constructor' when using @Input decorator?
up vote
1
down vote
favorite
How would I correctly initialize a property that has an @Input
decorator without removing strict typing?
Code below is what showing this warning
@Input
foo: FormGroup;
angular typescript
add a comment |
up vote
1
down vote
favorite
How would I correctly initialize a property that has an @Input
decorator without removing strict typing?
Code below is what showing this warning
@Input
foo: FormGroup;
angular typescript
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
How would I correctly initialize a property that has an @Input
decorator without removing strict typing?
Code below is what showing this warning
@Input
foo: FormGroup;
angular typescript
How would I correctly initialize a property that has an @Input
decorator without removing strict typing?
Code below is what showing this warning
@Input
foo: FormGroup;
angular typescript
angular typescript
edited yesterday
asked yesterday
Shane
1689
1689
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
There is no way to define a decorator such that Typescript will know it will perform field initialization. The only option is to add a definite assignment modifier to the field:
@Input
foo!: FormGroup;
This will disable the check for this field alone. You can read more about this assertion here
add a comment |
up vote
1
down vote
Props need to have an exclamation mark appended, i.e. foo!: FormGroup.
Related Issue
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
There is no way to define a decorator such that Typescript will know it will perform field initialization. The only option is to add a definite assignment modifier to the field:
@Input
foo!: FormGroup;
This will disable the check for this field alone. You can read more about this assertion here
add a comment |
up vote
2
down vote
accepted
There is no way to define a decorator such that Typescript will know it will perform field initialization. The only option is to add a definite assignment modifier to the field:
@Input
foo!: FormGroup;
This will disable the check for this field alone. You can read more about this assertion here
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
There is no way to define a decorator such that Typescript will know it will perform field initialization. The only option is to add a definite assignment modifier to the field:
@Input
foo!: FormGroup;
This will disable the check for this field alone. You can read more about this assertion here
There is no way to define a decorator such that Typescript will know it will perform field initialization. The only option is to add a definite assignment modifier to the field:
@Input
foo!: FormGroup;
This will disable the check for this field alone. You can read more about this assertion here
answered yesterday
Titian Cernicova-Dragomir
50.4k33148
50.4k33148
add a comment |
add a comment |
up vote
1
down vote
Props need to have an exclamation mark appended, i.e. foo!: FormGroup.
Related Issue
add a comment |
up vote
1
down vote
Props need to have an exclamation mark appended, i.e. foo!: FormGroup.
Related Issue
add a comment |
up vote
1
down vote
up vote
1
down vote
Props need to have an exclamation mark appended, i.e. foo!: FormGroup.
Related Issue
Props need to have an exclamation mark appended, i.e. foo!: FormGroup.
Related Issue
answered yesterday
Sajeetharan
112k27153208
112k27153208
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224437%2fhow-to-resolve-property-foo-has-no-initializer-and-is-not-definitely-assigned%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password