this document:
doesn't mention type parameters
Questions:
Yes, you can specify types with JSDoc in JavaScript for the TypeScript compiler to use...
/** @type {Window} */
var myWin;
/** @type {Event} */
var myEvent;
/**
* @param myStr {string} my parameter
* @return {string} returns a string
*/
function myFunction(myStr){
return myStr;
}
Available in TypeScript 2.3 and later.
Using generic type parameters:
/**
* @template T
* @param {T} thing
* @return {T}
*/
function getThing(thing){
return thing;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.