Skip to content

Change plugin and theme types.ts to types.d.ts#1281

Merged
sserrata merged 2 commits intoPaloAltoNetworks:mainfrom
omonk:main
Jan 27, 2026
Merged

Change plugin and theme types.ts to types.d.ts#1281
sserrata merged 2 commits intoPaloAltoNetworks:mainfrom
omonk:main

Conversation

@omonk
Copy link
Contributor

@omonk omonk commented Jan 21, 2026

Description

Change types.ts to a declaration file (types.d.ts) in both plugin and theme packages

Motivation and Context

Following on from #1220 we are still not able to run typescript checking across our site due to issues with how the internal types are defined in this package.

I have copied the docusaurus tsconfig from here into our repo https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-tsconfig/tsconfig.json

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Docusaurus",
  "docs": "https://docusaurus.io/docs/typescript-support",
  "compilerOptions": {
    "allowJs": true,
    "esModuleInterop": true,
    "jsx": "preserve",
    "target": "ES2022",
    "lib": ["ES2022", "DOM"],
    "moduleResolution": "bundler",
    "module": "esnext",
    "noEmit": true,
    "paths": {
      "@site/*": ["./*"]
    },
    "skipLibCheck": true
  },
  "include": ["api/", "src/", "scripts/"],
  "exclude": [".docusaurus", "build", "node_modules"]
}

Currently if I attempt to typecheck the repo we are still seeing errors from this package

yarn run tsc:check
node_modules/docusaurus-plugin-openapi-docs/src/types.ts:8:32 - error TS2307: Cannot find module '@docusaurus/plugin-content-docs/src/sidebars/types' or its corresponding type declarations.

8 import { SidebarItemDoc } from "@docusaurus/plugin-content-docs/src/sidebars/types";
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/docusaurus-plugin-openapi-docs/src/types.ts:24:8 - error TS2307: Cannot find module '@docusaurus/plugin-content-docs-types' or its corresponding type declarations.

24 } from "@docusaurus/plugin-content-docs-types";
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

skipLibCheck will only skip .d.ts files. If I change my local node module to .d.ts these errors go away.

How Has This Been Tested?

This repo will still build successfully with these changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@omonk omonk mentioned this pull request Jan 21, 2026
4 tasks
@omonk omonk changed the title update plugin package types as well Change plugin and theme types.ts to types.d.ts Jan 21, 2026
@omonk
Copy link
Contributor Author

omonk commented Jan 21, 2026

unsure why we're seeing failures on CI, local is fine

Successfully ran target build for 2 projects

@sserrata sserrata closed this Jan 26, 2026
@sserrata sserrata reopened this Jan 26, 2026
@sserrata
Copy link
Member

Hi @omonk, the build is failing since the theme package imports from the plugin's compiled output (lib/). The following should fix it in the StatusCodes component (line 19):

// Current
import { ApiItem } from "docusaurus-plugin-openapi-docs/lib/types";

// Change to this  
import type { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";

@omonk
Copy link
Contributor Author

omonk commented Jan 26, 2026

Thanks @sserrata will take a look this evening.

@omonk
Copy link
Contributor Author

omonk commented Jan 27, 2026

@sserrata thats updated now!

if we merge soon I would love to get this commit into the release which contains the perf improvements! thanks

@github-actions
Copy link

Visit the preview URL for this PR (updated for commit 7eb88d6):

https://docusaurus-openapi-36b86--pr1281-jn8a3omc.web.app

(expires Thu, 26 Feb 2026 14:43:39 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@sserrata sserrata merged commit 71621ac into PaloAltoNetworks:main Jan 27, 2026
10 checks passed
sserrata added a commit that referenced this pull request Jan 27, 2026
Major performance improvement: The new `externalJsonProps` option (enabled by default) dramatically reduces build times and bundle sizes by externalizing large JSON props from MDX files.

- New `externalJsonProps` plugin option significantly improves build performance
- Sticky positioning for the API Explorer right panel improves UX on long API pages
- Dynamic request body updates when switching anyOf/oneOf tabs

#### 🚀 New Feature

- feat(plugin): add externalJsonProps option (enabled by default) to improve build performance (#1279)
- feat(theme): add sticky positioning to API Explorer right panel (#1288)
- feat: dynamically update request body when anyOf/oneOf tab changes (#1287)

#### 🐛 Bug Fix

- fix: render inline enum values in anyOf schemas (#1286)
- fix: generate correct examples for different request content types (#1284)

#### 🏠 Refactoring

- refactor: change plugin and theme types.ts to types.d.ts (#1281)
- refactor: externalize using create() and drop size threshold requirement (#1280)

#### 📝 Documentation

- docs: sync README and intro.mdx with plugin docs

#### 🤖 Dependencies

- chore(deps): bump lodash from 4.17.21 to 4.17.23 (#1282)

#### Committers: 3

- dependabot[bot]
- Ollie Monk
- Steven Serrata
@sserrata sserrata mentioned this pull request Jan 27, 2026
sserrata added a commit that referenced this pull request Jan 27, 2026
Major performance improvement: The new `externalJsonProps` option (enabled by default) dramatically reduces build times and bundle sizes by externalizing large JSON props from MDX files.

- New `externalJsonProps` plugin option significantly improves build performance
- Sticky positioning for the API Explorer right panel improves UX on long API pages
- Dynamic request body updates when switching anyOf/oneOf tabs

#### 🚀 New Feature

- feat(plugin): add externalJsonProps option (enabled by default) to improve build performance (#1279)
- feat(theme): add sticky positioning to API Explorer right panel (#1288)
- feat: dynamically update request body when anyOf/oneOf tab changes (#1287)

#### 🐛 Bug Fix

- fix: render inline enum values in anyOf schemas (#1286)
- fix: generate correct examples for different request content types (#1284)

#### 🏠 Refactoring

- refactor: change plugin and theme types.ts to types.d.ts (#1281)
- refactor: externalize using create() and drop size threshold requirement (#1280)

#### 📝 Documentation

- docs: sync README and intro.mdx with plugin docs

#### 🤖 Dependencies

- chore(deps): bump lodash from 4.17.21 to 4.17.23 (#1282)

#### Committers: 3

- dependabot[bot]
- Ollie Monk
- Steven Serrata
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.

2 participants