npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

typescript-example-learn222

v1.0.2

Published

https://www.tslang.cn/docs/release-notes/typescript-2.2.html

Downloads

1

Readme

#中文文档 https://www.tslang.cn/docs/release-notes/typescript-2.2.html

#概要内容 1、装饰器 类声明,方法, 访问符,属性或参数 2、package相关说明

3、npm

4、lanuch.json

5、setting.json (1):"typescript.tsdk" (2):"files.exclude" (3):"editor.formatOnSave" 6、调试

7、泛型

8、Promise

9、解构

11、Proxy

12、规范 (1):如果在有限集里能够确定类型,一定要定义type或者interface,否则定义成any类型。 (2):如果需要约束某个键值(通常像一些switch的常量,事件的名字等),可通过泛型+keyof来实现 example1 switch(name){ case "type1":

        break;

        case "type2":

        break;
    }

example2
    instance.addEventListener("eventName",()=>{},this);

(3):尽量不要用function来表示函数,而使用箭头函数来替代,除非你有通过function里的作用域来获取函数实例本身。 (4):尽量不要用var 来申明变量,改为用let来申明变量,一般情况下,实在找不出理由还需要使用 var 关键字的。 (5):如果typescript能够推断出类型,尽量不要添加类型,例如:let a = 1;

13、生成器 generators * (typescript1.6) 14、收窄函数 a is Cat(typescript1.6) 15、this类型 16、幂运算符** **= 17、不可及的代码 18、非空断言操作符 object!.value 20、never类型 21、通配符 glob * 匹配任意 0 或多个任意字符 ? 匹配任意一个字符 [...] 若字符在中括号中,则匹配。若以 ! 或 ^ 开头,若字符不在中括号中,则匹配 !(pattern|pattern|pattern) 不满足括号中的所有模式则匹配 ?(pattern|pattern|pattern) 满足 0 或 1 括号中的模式则匹配 +(pattern|pattern|pattern) 满足 1 或 更多括号中的模式则匹配 (a|b|c) 满足 0 或 更多括号中的模式则匹配 @(pattern|pat|pat?erN) 满足 1 个括号中的模式则匹配 ** 跨路径匹配任意字符 22、索引访问类型 23、映射类型 Partial 将对象所有的属性变成可选 Readonly 将对象所有的属性变成可读 Required 将对象所有的属性变成必选 Pick 从对象中取可用的属性 Record Exclude Extract NonNullable ReturnType InstanceType 24、对象类型 object 25、数组与元组 let a:[string,number]; 26、普通字符串与模板字符串 `` 27、枚举 enum 28、联合与交叉类型 | & 29、类型别名 type 30、类型推论、类型断言、类型保护