Is TypeScript necessary to check the type of input parameter again?

  node.js, question

In traditional javascript development, it will be judged whether the parameters are correct.

var fn = function(param){
 if(typeof param !  == "string") throw "error type";
 //code start

Although TypeScript can help check types at compile time

let fn = function(param:string){
 return param.length;
 fn({a:1});  //An error will be thrown at compile time

However, when compiled into JS and called by non-TS personnel, it will report an error.

//After compiling into js
 Fn({a:1}) // Direct Error Reporting

Not all personnel in the group use TS. At this time, is the solution only to manually determine the parameter type? Or what solution does TS have?

If manual judgment is required, a problem will arise at this time.

interface params {
 //Here are 10 more attributes
 param?  :number;
 //code 10000 lines
 let fn = function(param:params):number{
 //If I need to judge the parameter type, first I will jump to the interface definition
 //Check the parameter type and jump back to write judgment
 //This way, there will be no coherent code and you will have to jump around.
 return param.labels.length;

No …