How to mark a function as a template literal tag with JsDoc?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 15.5k
- Forks
- 1.5k
- Avg merge
- 10d 23h
- Merged PRs (30d)
- 1
Description
Template literal tags are special types of functions that take an array of strings as the first argument and any number of placeholders after that. When a function is defined to be used for template literals, it's typically only used for that purpose, since it's a pretty specific form of function.
Is there any tag or preferred method to mark a function as such using JsDoc?
And what about ...rest arguments?
Example code
/**
* What goes here for JSDOC?
* @param ?
* @returns ?
*
* @example
* taggedTemplate`a${1}b${2}c${3}`;
*/
function taggedTemplate(strings, arg1, arg2, arg3, arg4, ...rest) {
console.log(strings);
console.log(arg1, arg2, arg3, arg4);
console.log(rest);
}
Expected behavior
Something about this in the doc.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no file, test, or entry point. Start by locating the documentation for JSDoc parameter and rest-argument syntax; done means documenting how to describe a tagged-template function and its rest arguments, with an example matching the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100