摘要: var service={ getStringValue:function(){ return "a string value"; } getNumberValue:function(){ return 20; }}; function middleware(value){ console.log( 阅读全文
posted @ 2023-05-04 22:57 .net&new 阅读(34) 评论(0) 推荐(0)
摘要: 1:环境安装 tsc 作用:负责将ts 代码 转为 浏览器 和 nodejs 识别的 js代码。 /全局安装 npm install -g typescript // 检查是否安装成功 tsc -v 2:自动编译 运行 tsc --init,创建 tsconfig.json 文件;修改 tsconf 阅读全文
posted @ 2023-05-04 22:11 .net&new 阅读(895) 评论(0) 推荐(1)
摘要: 默认枚举默认的情况下,默认的情况下第一项索引是 '1',逐渐递增,可正反映射 enum baseType { string, number, boolean, null, undefined, } console.log(baseType); /** 结果: { '0': 'string', '1' 阅读全文
posted @ 2023-05-04 22:07 .net&new 阅读(105) 评论(0) 推荐(0)
摘要: 报错原因 在新版本的npm中,默认情况下,npm install遇到冲突的peerDependencies时将失败。 解决办法 使用--force或--legacy-peer-deps可解决这种情况。 --force 会无视冲突,并强制获取远端npm库资源,当有资源冲突时覆盖掉原先的版本。 --le 阅读全文
posted @ 2023-05-04 20:40 .net&new 阅读(1447) 评论(0) 推荐(0)