microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

Home Page:https://www.typescriptlang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[transpileDeclaration API] What to do about "has or is using private name" diagnostics

MichaelMitchell-at opened this issue Β· comments

πŸ” Search Terms

isolated declarations transpile transpiledeclaration diagnostic private name

βœ… Viability Checklist

⭐ Suggestion

Either make ts.transpileDeclaration not report "has or is using private name" diagnostics, or provide a method to easily check whether a diagnostic is related to private names.

πŸ“ƒ Motivating Example

Usage of ts.transpileDeclaration for any project with isolatedDeclarations

πŸ’» Use Cases

ts.transpileDeclaration will report usage of global types such as Pick, Omit, Promise, or project-specific ones, as using private names. These are not really actionable, so I wonder if these diagnostics should just not be reported at all. What I've been doing is to just filter them out. The structured way of doing that is checking the diagnostic code, but there are so many codes to check that I decided to take a more unstructured approach by just checking diagnostic.messageText.includes('private name'). So at the very least, if these diagnostics will continue to be reported, it would be nice if there was some boolean method that says whether or not a given diagnostic is related to private names.