title: Type 'string | null' is not assignable to type 'string'. Type 'null' is not assignable to type 'string'
body: <p>Error: Type 'string | null' is not assignable to type 'string'.   Type 'null' is not assignable to type 'string'.
  Error : Type '{ id?: string | undefined; title?: string | undefined; content?: string | undefined; }' is not assignable to type 'Post'.
  Types of property 'id' are incompatible.
  Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.</p>
  <pre><code>export interface Post{
      id:string;
      title:string;
      content:string;
  }
  </code></pre>
  <pre><code>import { Component,OnInit} from '@angular/core';
  import { NgForm } from '@angular/forms';
  import { ActivatedRoute, ParamMap } from '@angular/router';
  import { Post } from '../post.model';
  
  import { PostsService } from '../posts.service';
  
  @Component({
    selector: 'app-post-create',
    templateUrl: './post-create.component.html',
    styleUrls: ['./post-create.component.css']
  })
  export class PostCreateComponent implements OnInit {
  
  // newPost='No Content'
  enteredTitle='' 
    enteredContent=''
  private mode='create'
  private postId:string 
  private post:Post
    // postId: string | null | undefined;
  
  constructor(public postsService:PostsService
    ,public route: ActivatedRoute){}
  
  ngOnInit(){
    this.route.paramMap.subscribe((paramMap:ParamMap)=&gt;{
      if(paramMap.has('postId')){
        this.mode='edit'
        this.postId=paramMap.get('postId')
        this.post=this.postsService.getPost(this.postId)
      }else{
        this.mode='create'
        this.postId=&quot;null&quot;;
      }
    });
  }
  
  onAddPost(form:NgForm){ 
    if(form.invalid)
    {
      return
    } 
    console.log((form.value.title,form.value.content));
    this.postsService.addPost(form.value.title,form.value.content)
  
  form.resetForm();
  
  }
  }
  </code></pre>