Why there is no compile time error when 'string' functions are used on an 'any' field type variable in TypeScript?

前端 未结 0 1195
夕颜
夕颜 2021-02-01 18:06

I have the following typescript code :

 let a; 
 a = "number"; 
 let t = a.endsWith(\'r\'); 
 console.log(t); 

Since a is not declared

相关标签:
回答
  • 消灭零回复
提交回复
热议问题