zl程序教程

您现在的位置是:首页 >  后端

当前栏目

[Tools] Unlock TypeScript's Features in Vanilla JS with @ts-check and JSDoc

JStypescript in and &# with 39 tools
2023-09-14 08:59:15 时间

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(123)