google / google/closure-compiler
JSDoc string literals not supported in Closure
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
String literals are supported in many JSDoc interpreters, but not in Closure.
For example:
```
/**
* @description Compress a file
* @param {string} filename
* @param {"zip"|"gz"} type
*/
function compressFile(filename, type) {
console.log(`Compressing file ${filename} with ${type}`);
}
compressFile("myfile.txt", "gz");
```
but when I run it against the Closure Compiler, I get the following output:
```
poc.js:4: WARNING - Bad type annotation. Unknown type "zip"
* @param {"zip"|"gz"} type
^
poc.js:4: WARNING - Bad type annotation. Unknown type "gz"
* @param {"zip"|"gz"} type
^
```
There's some discussion of this feature here: https://github.com/jsdoc/jsdoc/issues/629
What's the correct way to achieve this with Closure? I can't find anything about it in the documentation.
Contributor guide
Assessment
This issue has not been assessed yet.