8

typescript 里, 从后端接口获取的数据类型, 是声明全局类型呢, 还是模块类型呢

 2 years ago
source link: https://www.v2ex.com/t/868154
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

typescript 里, 从后端接口获取的数据类型, 是声明全局类型呢, 还是模块类型呢

  bthulu · 3 小时 48 分钟前 · 358 次点击

全局类型, 其他文件里用到的时候不用 import 声明文件, 直接用就是了. 模块类型的话, 其他文件里用到, 就必须 import 声明文件. 其他文件频繁用到的话, 是不是声明全局类型方便点? 但是我在 stackoverflow 上又看到有人说, 声明全局类型只用来处理安装的第三方依赖没有类型文件的情况. 自己 ts 代码中是不建议这么用的.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK