microsoft / microsoft/TypeScript
Unable to retain JSDocs for higher order function
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Go
- Estrelas
- 111k
- Forks
- 14.4k
- Merge médio
- 1d 19h
- PRs com merge (30d)
- 117
Descrição
Bug Report
When it comes to higher order function, the JSDocs for the resulting function are not persisted after transpile. declarationMap does not help in this regards either.
🔎 Search Terms
jsdocs, comments, higher order function, declarationmap
🕗 Version & Regression Information
4.9.4, but this should happen to all older versions.
"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs
Please keep and fill in the line that best applies:
-->
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
⏯ Playground Link
No playground link, as this requires transpilation.
💻 Code
/**
* this comment retains
**/
export function higher() {
/**
* this comment does not
**/
return function() {}
}
When using this code locally, the returning function does get the comment:
const foo = higher()
foo() // comment shows here
But once it is transpiled and published, the consumer of the package will not get the comment,
even if the package include the source, and using declarationMap
🙁 Actual behavior
No JSDocs comment.
🙂 Expected behavior
JSDocs comment should retain to aids consumer of the package.
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece reproduzindo o problema com o exemplo de função de ordem superior e uma transpilação que emita declarações; depois, compare o resultado do código-fonte local com o que o consumer da versão publicada consegue ver. Investigue como a saída transpilada e declarationMap lidam com o JSDoc da função retornada. A tarefa estará concluída quando o comentário for preservado e estiver visível para os consumers após a transpilação.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- typescript
- Domínio
- compilers
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 30/100