Skip to content

fix: resolve type map URL collisions#45

Closed
TusharThakur04 wants to merge 3 commits intowebpack:mainfrom
TusharThakur04:fix/type-map-collision
Closed

fix: resolve type map URL collisions#45
TusharThakur04 wants to merge 3 commits intowebpack:mainfrom
TusharThakur04:fix/type-map-collision

Conversation

@TusharThakur04
Copy link
Contributor

@TusharThakur04 TusharThakur04 commented Mar 24, 2026

Closes: #3

Summary
This PR :

  • resolves the type map URL collisions using getFullUrl()
  • also update slugger import path

What kind of change does this PR introduce?
fix

Did you add tests for your changes?
no

Does this PR introduce a breaking change?
no

If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a

Use of AI
used ai to skim through the codebase.

Screenshot from 2026-03-24 05-42-39

@TusharThakur04 TusharThakur04 force-pushed the fix/type-map-collision branch from 1de31e5 to 034eeec Compare March 24, 2026 00:21
Copy link
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these are valid anchors, tbh any PRs changing the type map are kind of irrelevant since we have to overhaul it to be valid anyway.

@TusharThakur04
Copy link
Contributor Author

got it, should i work on the overhaul in this PR ?

@TusharThakur04 TusharThakur04 force-pushed the fix/type-map-collision branch from 034eeec to 73facfb Compare March 24, 2026 02:27
@SankalpArya-255
Copy link

Following @avivkeller's suggestion to overhaul the type-map instead of patching it, I reworked the generation approach to address URL collisions at the root.

The previous implementation relied on getAnchoredURL(), which generates anchors from member names only (e.g., #constructor, #apply), leading to large-scale collisions across classes.

I replaced this with a Markdown-driven approach:

  • Parse generated Markdown files (globals.md and namespace docs)
  • Extract class and member headings directly
  • Generate class-scoped, deterministic anchors

Examples:

Cache.get → globals.md#class-cache-get
Compiler.apply → globals.md#class-compiler-apply
image

This eliminates collisions entirely:

  • 0 duplicate URLs
  • Each API member maps to a unique, stable anchor
  • Anchors now align with actual rendered documentation

Happy to open a PR with this approach if this direction makes sense.

@avivkeller
Copy link
Member

Hi @TusharThakur04 and @SankalpArya-255!

The type map is something that needs a lot of improvements. Merely resolving collisions isn't enough to make sure all the anchors work, and everything that needs to be anchors is properly done so.

Because of the complex work that must be taken into account for this change, I feel that it is best this issue be saved until GSoC, where the mentors can more expertly advise on the best course of action.

I know I originally labeled the issue that this resolves as one for a good contribution, but after attempting to resolve the issue on my own for a short period of time, I now feel that it is something that the approach must be carefully thought out.

For this reason, I am closing this PR. I greatly appreciate the effort put in here, but there's simply more work that needs to be thought out before this can come together (for instance, do we map every type? Do we set up our docs in a way where no map is needed (i.e. by prefixing all types with their file, like ci.createColors over createColors?)

I'm curious to see how proposals may tackle the issue of odd types.

@avivkeller avivkeller closed this Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type Map

3 participants