zoukankan      html  css  js  c++  java
  • typings的理解


    简介
    一些js库扩展了JavaScript的特性和语法,但是TypeScript编译器并不识别,
    通过typings.json配置可以辅助IDE,给出有智能的提示信息,以及重构的依据。
    因此需要在typings.json文件中配置TypeScript类型定义文件(文件名后缀为.d.ts)

    自己的理解
    typings就方便TypeScript识别、编译、智能提示TypeScript无法识别的JS库的特性和语法

    命令集


    #全局安装typings
    npm install typings --global

    #搜索
    typings search module

    #查找
    typings search --name module
    #安装(默认使用npm)
    typings install module --save

    #使用数据源为dt安装
    typings install dt~module --global --save

    #其他数据源安装
    typings install env~module --global --save
    typings install npm~module --save

    #可以直接用github,后面为github的项目路径https://github.com/DefinitelyTyped/DefinitelyTyped #后面为提交的版本号,可以不写
    typings install github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#38fb591c6eba840e0b53d1110302b8e4fb04652c --global --save

    #显示所有引用
    cat typings/index.d.ts



    数据源
    npm - dependencies from NPM
    github - dependencies directly from GitHub (E.g. Duo, JSPM)
    bower - dependencies from Bower
    common - "standard" libraries without a known "source"
    shared - shared library functionality
    lib - shared environment functionality (mirror of shared) (--global)
    env - environments (E.g. atom, electron) (--global)
    global - global (window.<var>) libraries (--global)
    dt - typings from DefinitelyTyped (usually --global)
  • 相关阅读:
    学习中的坑
    友链
    CF1131E String Multiplication 题解
    CF438E The Child and Binary Tree 题解
    [WC2005]友好的生物题解
    [IOI2016]shortcut 题解
    CF911F [Tree Destruction] 题解
    状压dp技巧之轮廓线 hdu1400/poj2411acwing291 蒙德里安的梦想
    TG-WC2021 笔记
    拯救世界2题解
  • 原文地址:https://www.cnblogs.com/liuyt/p/5688137.html
Copyright © 2011-2022 走看看