How can I fix : Type String Null is not assignable to type String Undefined

i am having problems with my code, is a POS and I am trying to do the Sell part, but this error is keeping me for days and I don’t know how to fix it.

X [ERROR] NG2: Type 'string | null' is not assignable to type 'string | undefined'.
  Type 'null' is not assignable to type 'string | undefined'. [plugin angular-compiler]

    src/app/pages/mesa-detalle/mesa-detalle.component.html:59:84:
      59 │ ...| 'Nombre no disponible'" [subheader]="(getPrecioProducto(produ...

This is the HTML

<app-header></app-header>

<div class="content">
  <div class="card">
    <p-toast></p-toast>
    <p-toolbar>
      <div class="p-toolbar-group-left">
        <p-button label="Añadir producto" icon="pi pi-plus" (click)="abrirProductoDialogo()"></p-button>
      </div>
    </p-toolbar>

    <p-table [value]="pedidos" [paginator]="true" [rows]="10" [showCurrentPageReport]="true" currentPageReportTemplate="Mostrando {first} a {last} de {totalRecords} entradas">
      <ng-template pTemplate="header">
        <tr>
          <th>Nombre del Producto</th>
          <th>Cantidad</th>
          <th>Precio</th>
          <th>Acciones</th>
        </tr>
      </ng-template>
      <ng-template pTemplate="body" let-pedido>
        <tr>
          <td>{{ pedido.nombre }}</td>
          <td>{{ pedido.cantidad }}</td>
          <td>{{ pedido.precio | currency }}</td>
          <td>
            <p-button icon="pi pi-trash" class="p-button-rounded p-button-danger" (click)="eliminarPedido(pedido)"></p-button>
          </td>
        </tr>
      </ng-template>
    </p-table>

    <div class="p-grid">
      <div class="p-col-12">
        <div class="p-card">
          <div class="p-card-header">
            <h5>Precio Total</h5>
          </div>
          <div class="p-card-body">
            <ul>
              <li *ngFor="let pedido of pedidos">{{ pedido.nombre }}: {{ pedido.precio * pedido.cantidad | currency }}</li>
            </ul>
            <h4>Total: {{ calcularTotal() | currency }}</h4>
          </div>
          <div class="p-card-footer">
            <p-button label="Pagar" icon="pi pi-check" (click)="generarTicket()"></p-button>
          </div>
        </div>
      </div>
    </div>

    <p-dialog header="Seleccionar Producto" [(visible)]="productoDialogo" [modal]="true" [style]="{width: '70vw', height: '80vh'}">
      <div class="p-grid p-fluid">
        <div class="p-field">
          <label for="terminoBusqueda">Buscar Producto</label>
          <input id="terminoBusqueda" type="text" pInputText [(ngModel)]="terminoBusqueda" (input)="buscarProductos()"/>
        </div>
        <div class="p-col-12 p-md-6" *ngFor="let producto of productos">
          <p-card [header]="getNombreProducto(producto) || 'Nombre no disponible'" [subheader]="(getPrecioProducto(producto) | currency)">
            <button pButton label="Añadir" (click)="anadirProducto(producto)"></button>
          </p-card>
        </div>
      </div>
    </p-dialog>

  </div>
</div>

TypeScript

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { jsPDF } from 'jspdf';
import { Pedido } from "../../interfaces/Pedido";
import { Producto } from "../../interfaces/producto";
import { ProductoService } from "../../service/producto.service";
import { PedidoService } from "../../service/pedido.service";

@Component({
  selector: 'app-mesa-detalle',
  templateUrl: './mesa-detalle.component.html',
  styleUrls: ['./mesa-detalle.component.css']
})
export class MesaDetalleComponent implements OnInit {
  mesaId!: number;
  pedidos: Pedido[] = [];
  productos: Producto[] = [];
  productoDialogo = false;
  terminoBusqueda = '';

  nuevoPedido: Pedido = { nombre: '', cantidad: 0, precio: 0, mesaId: 0 };

  constructor(
    private route: ActivatedRoute,
    private productoService: ProductoService,
    private pedidoService: PedidoService
  ) {}

  ngOnInit(): void {
    this.mesaId = Number(this.route.snapshot.paramMap.get('id'));
    this.obtenerPedidos();
  }

  obtenerPedidos(): void {
    this.pedidoService.getPedidosByMesaId(this.mesaId).subscribe(
      (data) => {
        this.pedidos = data;
      },
      (error) => {
        console.error(error);
      }
    );
  }

  buscarProductos(): void {
    if (this.terminoBusqueda) {
      this.productoService.buscarProductos(this.terminoBusqueda).subscribe(
        (data) => {
          this.productos = data;
        },
        (error) => {
          console.error(error);
        }
      );
    }
  }

  abrirProductoDialogo(): void {
    this.productoDialogo = true;
    this.buscarProductos();
  }

  anadirProducto(producto: Producto): void {
    const nuevoPedido: Pedido = {
      nombre: this.getNombreProducto(producto),
      cantidad: 1,
      precio: this.getPrecioProducto(producto),
      mesaId: this.mesaId
    };

    this.pedidoService.addPedido(nuevoPedido).subscribe(
      (data) => {
        this.pedidos.push(data);
        this.productoDialogo = false;
      },
      (error) => {
        console.error(error);
      }
    );
  }

  getNombreProducto(producto: Producto): string {
    return producto.nombre ?? 'Nombre no disponible';
  }

  getPrecioProducto(producto: Producto): number {
    return producto.precio ?? 0;
  }

  calcularTotal(): number {
    return this.pedidos.reduce((total, pedido) => total + pedido.precio * pedido.cantidad, 0);
  }

  generarTicket(): void {
    const doc = new jsPDF();

    doc.setFontSize(18);
    doc.text('Ticket de Compra', 20, 20);

    doc.setFontSize(12);
    doc.text('Mesa: ' + this.mesaId, 20, 30);
    doc.text('Fecha: ' + new Date().toLocaleString(), 20, 40);

    let y = 50;
    doc.setFontSize(10);
    doc.text('Producto', 20, y);
    doc.text('Cantidad', 90, y);
    doc.text('Precio', 140, y);
    doc.text('Total', 180, y);

    y += 10;
    this.pedidos.forEach((pedido) => {
      doc.text(pedido.nombre || 'Nombre no disponible', 20, y);
      doc.text(pedido.cantidad.toString(), 90, y);
      doc.text(pedido.precio?.toFixed(2) || '0.00', 140, y);
      doc.text((pedido.precio! * pedido.cantidad).toFixed(2), 180, y);
      y += 10;
    });

    y += 10;
    doc.setFontSize(12);
    doc.text('Total a pagar: ' + this.calcularTotal().toFixed(2), 20, y);

    doc.save(`ticket_mesa_${this.mesaId}.pdf`);
  }

  eliminarPedido(pedido: Pedido): void {
    if (pedido.id !== undefined) {
      this.pedidoService.deletePedido(pedido.id).subscribe(
        () => {
          this.pedidos = this.pedidos.filter(p => p.id !== pedido.id);
        },
        (error) => {
          console.error(error);
        }
      );
    } else {
      console.error('Pedido ID is undefined');
    }
  }
}

Interface:

export interface Pedido {
  id?: number | undefined;
  mesaId: number;
  precio: number;
  cantidad: number;
  nombre: string | null;
}

I am using Angular and PrimeNG, have someone have the same error and could fix it? let me know

I am tryng to do the sell part, where you select the item and can search by name the item, but i get the error.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật