
Obsidian插件DataviewJS —— TypeScript速成(六)
一、类型 1. 为什么需要类型 在一个多人协作的大型项目中,小明作为基础库的研发工程师,提供了一个公共函数调用 showInput(input),定义如下: function showInput(input) { return input.show(); } 此时,作为业务调用方的小红,在业务代码中作出调用: // 在javascript中调用报错 // Uncaught TypeError: input.show is not a function showInput(“hello world”); 看过前面的函数定义,我们知道以上代码不出意外会报错,因为 hello world字符串没有s […]