Why do i face 'argument of type is not assignable to parameter of type' in typescript?

This error occurs when you pass an argument of an incorrect type to a function or method.

Example:

  function displayLength(str: string) {
      console.log(str.length);
  }
  displayLength(100);
  
Solution:

  function displayLength(str: string) {
      console.log(str.length);
  }
  displayLength("100");
  

Beginner's Guide to TypeScript