RFC: Syntax for "declaration references" (hyperlinks)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5k
- Forks
- 162
- Avg merge
- 17h 24m
- Merged PRs (30d)
- 8
Description
Certain tags such as {@inheritdoc} contain references to other API items. AEDoc supports two notations for API item references:
-
For internal references, we use:
exportName.memberNameExample:
{@inheritdoc BaseWidget.draw}The "
.memberName" is optional and included e.g. if the API item is a member of a class or interface. -
For external references, we use:
@scopeName/packageName:exportName.memberNameExample:
{@inheritdoc @microsoft/widget-lib:BaseWidget.draw}The "
@scopeName/" and ".memberName" are optional. The "@scopeName/" is used for scoped NPM packages.
This might be a reasonable starting point. However, it doesn't consider nesting members such as namespaces (which has turned out to be surprisingly common for legacy SDKs, despite all the downsides and attempts to deprecate them).
Also, AEDoc today overlooks an interesting edge case:
export class A {
public b: string = 'hello';
}
export namespace A {
export let b: number = 123;
}
let a = new A();
// a.b is a string
// A.b is a number
In this example, an expression such as {@link A.b} would be ambiguous. Which declaration is it referring to? How to handle this?
Contributor guide
No contributing guide indexed for this repository
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
Start by reviewing the AEDoc API item reference notation and the TypeScript example in this issue. Define how references represent nested members and how the ambiguous A.b case is resolved; done means the syntax and resolution rules are specified for these cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100