PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs

Question/documentation for swizzling components with regards to TypeScript definitions

Open
#920 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
TypeScript
Stars
1.1k
Forks
315
Avg merge
7d 5h
Merged PRs (30d)
7

Description

Documentation link

It doesn't exist yet.

Describe the problem

If I swizzle a component, e.g. ApiExplorer/index.tsx, my TypeScript configuration will start complaining with errors such as this:

/ApiExplorer/Response/index.tsx(44,47): error TS2339: Property 'hide_send_button' does not exist on type 'DocFrontMatter'.

As far as I can, this is happening because docusaurus-openapi-docs is extending @docusaurus/theme-common/internal and adding its own custom types to this namespace, and my TypeScript config isn't aware of it.

Is there a recommendation for how to configure tsconfig.json to support these custom types, or plans to stop doing this and define types in this package's namespace instead?

Suggested fix

  • Document how to configure TypeScript to support custom @docusaurus/theme-common/internal type definitions
  • Move custom types into the definitions for this package, remove custom type definitions e.g. theme-classic.d.ts
  • Something else?

Workaround

Swizzling ApiExplorer/index as JavaScript (.tsx) rather than as TypeScript, works as expected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tsconfig.json, the swizzled ApiExplorer/index.tsx and Response/index.tsx files, and the package's theme-classic.d.ts definitions. Determine how the custom types are exposed and whether the supported outcome is a documented TypeScript configuration or a package type-definition change; verify that a TypeScript-swizzled component no longer reports the described error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.