Skip to content

fix: resolve reflection, declaration, and function types instead of hardcoded strings#59

Closed
Bharadwaj-2024 wants to merge 2 commits intowebpack:mainfrom
Bharadwaj-2024:fix/resolve-type-information
Closed

fix: resolve reflection, declaration, and function types instead of hardcoded strings#59
Bharadwaj-2024 wants to merge 2 commits intowebpack:mainfrom
Bharadwaj-2024:fix/resolve-type-information

Conversation

@Bharadwaj-2024
Copy link
Copy Markdown

Problem

The custom TypeDoc theme has three type rendering functions in plugins/theme/partials/types.mjs that return hardcoded placeholder strings instead of inspecting the actual TypeDoc model data:

  • declarationType() always returned '{object}'
  • functionType() always returned '{Function}'
  • The reflection case in resolve() always returned 'object'

This caused every function, callback, and complex object type across all generated docs to display as generic {object} or {Function}.

Before:

const applyWebpackOptionsDefaults: {object}
const createColors: {object}
const isColorSupported: {object}

After:

const applyWebpackOptionsDefaults: {(options: WebpackOptionsNormalized, compilerIndex?: number) => ResolvedOptions}
const createColors: {(__namedParameters?: ColorsOptions) => Colors}
const isColorSupported: {() => boolean}

Changes

  • Added resolveReflection() to inspect declaration signatures, children, and index signatures
  • Added resolveParams() helper for formatting parameter lists
  • Updated declarationType(model) to render actual types from DeclarationReflection
  • Updated functionType(model) to render types from SignatureReflection[]
  • Separated reflectionType from someType alias to use resolveReflection
  • Regenerated pages/ to reflect improved output

Verification

  • npm run generate-docs ✅
  • npm run build-html ✅
  • npm run lint ✅

@linux-foundation-easycla
Copy link
Copy Markdown

CLA Not Signed

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.

1 participant