TypeScript can help you with your plain JavaScript files if you add a simple //@ts-check comment. Then you can enhance the experience by add proper JSDocs to describe your functions which will feed type information into TypeScript and give you a development experience near TypeScript itself.

//@ts-check

/**
* @param {string} greeting
* @return {string}
*/
function greeting (greeting) {
return greeting
} greeting()

[Tools] Unlock TypeScript's Features in Vanilla JS with @ts-check and JSDoc的更多相关文章

  1. JavaScript代码编写尝试使用Vanilla JS 或者Jquery插件

    From Here: http://vanilla-js.com/ Vanilla JS is a fast, lightweight, cross-platform frameworkfor bui ...

  2. 在 Ionic2 TypeScript 项目中导入第三方 JS 库

    原文发表于我的技术博客 本文分享了在Ionic2 TypeScript 项目中导入第三方 JS 库的方法,供参考. 原文发表于我的技术博客 1. Typings 的方式 因在 TypeScript 中 ...

  3. making a resizable div effect in vanilla js

    making a resizable div effect in vanilla js scroll image compare <!DOCTYPE html> <html lang ...

  4. js screen size check

    js screen size check js 屏幕尺寸检测 window.screen API screen; window.screen.width; window.screen.height; ...

  5. TypeScript 如何编写类库声明文件 .d.ts

    TypeScript 如何编写类库声明文件 .d.ts how to write a d.ts file declaration-files/ https://www.typescriptlang.o ...

  6. 6、什么是TypeScript、TypeScript的安装、转换为.js文件

    1.什么是TypeScript (本人用自己的理解梳理了一下,不代表官方意见) TypeScript:Type+ECMAScript6 TypeScript是一种预处理编程语言,遵循es6标准规范,在 ...

  7. TypeScript 项目报错 Unknown file extension ".ts"

    下图是该问题的详细报错截图,经过多次捣鼓,初步猜测是模块有问题,要用 ES Module 还真是曲折,最不容易出错的就是 CommonJS 模块: 在百度.Bing 上搜索了好久的帖子也都没有相关的解 ...

  8. php和js以及ts的传值

    egret是用ts写h5游戏,然后编译为js,有些数据想在加载时由服务端生成. 一种方法用网络请求,另外一种方法直接传值. 网络请求如果在运行中,有数据交互,其实是个比较好的选择. 而我只是在初始化时 ...

  9. js,ts操作dom总结

    以上面为例: js获取placeholder节点 : document.getElementsByClassName("newTicket")[0].getAttributeNod ...

随机推荐

  1. win10的VMware虚机host-only模式下,虚拟机无法ping通物理机,而物理机能ping通虚机

    1.打开控制面板—->Windows防火墙(win10操作系统) 2.点击最上面的”允许应用或功能通过xxxxx” 3.勾上上图的“文件和打印机共享” 然后点确定.

  2. Rsync+Inotify 搭建实时同步数据

    1.安装软件包 # yum install inotify-tools # yum -y install rsync 2.同步机器相互添加信任 [root@host-10-0-100-106 ~]# ...

  3. Openstack 清除openstack网络与路由 (十七)

    一)清除openstack网络与路由 “清除openstack网络与路由”和”添加openstack网络与路由”的操作步骤相反. 添加网络或路由时是先建 搭建网络>搭建子网>建立端口, 而 ...

  4. python怎么解压压缩的字符串数据

    范例1: gzip import StringIO import gzip compresseddata = gzip方式压缩的字符串(html) compressedstream = StringI ...

  5. fetch初步了解

    前言 对于ajax请求,我们不仅可以使用XMLHTTPrequest,还可以使用fetch 正文 promise 在使用ajax时,如果想要使得第二个ajax请求调用第一个ajax请求,就得使用在on ...

  6. 0818JavaWeb基础

    Java Web基础 JSP JSP --- Java Server Page        在服务器上运行的页面 动态网页(JSP网页)        与后台有数据交换的网页             ...

  7. 【BZOJ 1115】【POI 2009】石子游戏Kam

    http://www.lydsy.com/JudgeOnline/problem.php?id=1115 差分后变成阶梯博弈. #include<cstdio> #include<c ...

  8. AtCoder - 3939 Strange Nim

    Problem Statement Takahashi and Aoki are playing a stone-taking game. Initially, there are N piles o ...

  9. [UOJ218]火车管理

    建一棵答案线段树存栈顶值,两棵可持久化线段树分别存栈顶值和栈顶元素入栈时间 询问就直接在答案线段树上查,弹栈就用入栈时间在对应版本的可持久化线段树上查询即可,修改就是可持久化线段树的区间覆盖 以前一直 ...

  10. 【数论】bzoj1968 [Ahoi2005]COMMON 约数研究

    对于i属于[1,n],i只能成为[1,n]中n/i个数的约数,易证. #include<stdio.h> int n,i; long long ans; int main() { scan ...