• TypeScript 学习笔记-JSDoc


    使用JSDoc

     /**基础类型*/
     /**@type {string} */
    
     /**联合类型 */
     /**@type {string | number} */
    
     /**数组类型 */
     /**@type {string[]} */
     /**@type {Array.<string>} */
    
     /**对象字面量类型 */
     /**@type {a:string,b:number} */
    
     /**map-like 类型 */
     /**@type {Object.<string,number>} */
    
     /**array-like 类型 */
     /**@type {Object.<number,object>} */
    
     /**closure 语法 */
     /**@type {function(string,boolean):number} */
     /**TypeScript 语法 */
     /**@type {(a:string,b:string) => number} */
    
     /**函数类型 */
     /**@type {function} */
    
     /**任意类型 */
     /**@type {*} */
     /**@type {?} */
    
     /**导入类型 */
     /**@param {import('./a').Pet} */
     /**@typedef Pet {import("./a").Pet} */
     /**@type {Pet} */
    
     /**params语法类似于type,唯一区别于可选属性 ,arg可选且默认值为test*/
     /**@param [arg = 'test'] */
    
     /**返回值类型 */
     /**@return {string} */
    
     /**复杂类型 */
     /**@typedef {prop1:string,prop2:string,prop3?:number} SpecialType */
     /**@typedef {(prop1:string,prop2?:number) => number} Predicate*/
    
     /**泛型类型 */
     /**@template T */
     /**@param {T} */
     /**@return {T} */
     function id(x) {return x;}
    
     /**指定this的类型 */
     /**@this {HTMLElement} */
    
     
    /**基础类型*/
    /**@type{string} */

    /**联合类型 */
    /**@type{string | number} */

    /**数组类型 */
    /**@type{string[]} */
    /**@type{Array.<string>} */

    /**对象字面量类型 */
    /**@type{a:string,b:number} */

    /**map-like 类型 */
    /**@type{Object.<string,number>} */

    /**array-like 类型 */
    /**@type{Object.<number,object>} */

    /**closure 语法 */
    /**@type{function(string,boolean):number} */
    /**TypeScript 语法 */
    /**@type{(a:string,b:string) => number} */

    /**函数类型 */
    /**@type{function} */

    /**任意类型 */
    /**@type{*} */
    /**@type{?} */

    /**导入类型 */
    /**@param{import('./a').Pet} */
    /**@typedefPet {import("./a").Pet} */
    /**@type{Pet} */

    /**params语法类似于type,唯一区别于可选属性 ,arg可选且默认值为test*/
    /**@param [arg = 'test'] */

    /**返回值类型 */
    /**@return{string} */

    /**复杂类型 */
    /**@typedef{prop1:string,prop2:string,prop3?:number}SpecialType */
    /**@typedef{(prop1:string,prop2?:number) => number}Predicate*/

    /**泛型类型 */
    /**@templateT */
    /**@param{T} */
    /**@return{T} */
    function id(x) {return x;}

    /**指定this的类型 */
    /**@this{HTMLElement} */

     
  • 相关阅读:
    vue3 祖孙传递数据
    vue 导航栏不能收缩的问题
    vue 项目中的问题
    Python第一周Round1记录
    [转]80端口被系统占用pid=4: NT kernel & System
    表<表名称> 中的列与现有的主键或UNIQUE约束不匹配
    一些算法(2)
    卸载不了java(tm)se development kit 7 update 3
    如何解决 Eclipse中出现访问限制由于对必需的库XX具有一定限制,因此无法访问类型
    [COPY]Eclipse无法导入项目
  • 原文地址:https://www.cnblogs.com/goOtter/p/9774567.html
Copyright © 2020-2023  润新知