• 请不要在回答技术问题时复制粘贴 AI 生成的内容
WhyAreYouSoSad
V2EX  ›  程序员

typescript 好像类库很少?

  •  
  •   WhyAreYouSoSad · Apr 18, 2018 · 2547 views
    This topic created in 3135 days ago, the information mentioned may be changed or developed.

    在找一个集合操作类库,可以在指定位置插入和删除的。有大佬推荐下吗

    4 replies  •  2018-04-18 18:09:26 +08:00
    sjn9588
    sjn9588
    Apr 18, 2018
    1
    lodash 吧。TS 好处之一就是只要有对应的 d.ts 文件能使用 JS 库。
    banxi1988
    banxi1988
    Apr 18, 2018
    2
    1. JS 库即 TS 库
    2. JS 库要让 TS 的编译系统识别需要 声明文件(.d.ts), 参考 : https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html
    比如安装 lodash 可以使用 `npm install --save @types/lodash`
    3. 如上一般的库都有 `@types/库名称` 对应的声明库。 你可以直接在 npm 上按此规则搜索。也可以在这里搜索:
    http://microsoft.github.io/TypeSearch/

    4. 你可以把 `.d.ts` 文件当作于 C/C++ 中的头文件。
    Pastsong
    Pastsong
    Apr 18, 2018
    3
    momocraft
    momocraft
    Apr 18, 2018
    4
    你想要的东西和 Array 的区别在哪
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2582 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 04:27 · PVG 12:27 · LAX 20:27 · JFK 23:27
    ♥ Do have faith in what you're doing.