Description
@evanargelion has been asking about defining custom TSDoc tags for toolchain directives. A build task would use the compiler API to extract the comments, invoke the TSDoc parser, and then use this information to affect the build output. For example:
/**
* @clientCallable(excludedFromRest = true)
* @apiSet(version = PolyfillableDownTo1_1, IntroducedInVersion = 1.3)
*/
export class BindingSelectionChangedEventArgs {
. . .
}
He'd like for IntelliSense to help developers write these tags correctly, but without having to implement a custom VS Code extension.
One idea would be to rely on the compiler type system, e.g. define clientCallable
and apiSet
as a TypeScript interface (similar to how JavaScript decorators or .NET attributes work). However in TypeScript that would probably require the definitions to be imported into the TypeScript source file. It also means the IntelliSense requires a compiler analysis and source code that compilers (maybe as a separate NPM package that would be a dev dependency?).
Another idea would be to define a simpler data file where these definitions can be found, something like a JSON schema. This has the advantage that TSDoc itself could validate these schemas while remaining decoupled from the TypeScript compiler.
Is this an important developer scenario for anyone else? How would you design it?