-1

I have two projects, and in one, this code yields no error:

  form: FormGroup = new FormGroup({
    s: new FormControl('')
  })

  fo$ = this.form.get('s').valueChanges.pipe(
    map(a => console.log('something'))
  );

But in my new project, this brings up the error "Object is possibly 'null'." How can I solve this?

NeNaD
  • 18,172
  • 8
  • 47
  • 89
Vladimir Despotovic
  • 3,200
  • 2
  • 30
  • 58

1 Answers1

1

Problem

It's probably the case where you have strict mode enabled in one project, and disabled in other project.

Solution

Go to the tsconfig.json file and disable strict mode in the project where it's enabled.

NeNaD
  • 18,172
  • 8
  • 47
  • 89