Skip to content

Conversation

@omonk
Copy link
Contributor

@omonk omonk commented Dec 4, 2025

Description

Change packages/docusaurus-plugin-openapi-docs/src/types.ts to a declaration file.

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
Copy link
Contributor Author

omonk commented Dec 5, 2025

@sserrata would you be able to take a look at this please?

@sserrata
Copy link
Member

Thanks @omonk! This is a valid fix - .d.ts files are properly skipped by skipLibCheck.

Before merging, I think we should also fix:

packages/docusaurus-plugin-openapi-docs/src/sidebars/index.ts line 15 imports from /src/ which has the same issue:
} from "@docusaurus/plugin-content-docs/src/sidebars/types";

Should probably be /lib/ instead:

from "@docusaurus/plugin-content-docs/lib/sidebars/types";

Also, can you confirm yarn build-packages and yarn test pass after these changes? The build is failing in our pipeline.

@sserrata sserrata added the reviewing 👀 Undergoing manual audit to determine if issue should still be active label Dec 17, 2025
@sserrata sserrata self-assigned this Dec 17, 2025
@omonk omonk closed this Dec 23, 2025
@omonk
Copy link
Contributor Author

omonk commented Dec 23, 2025

@sserrata thanks for the nudge. I'll give it another go as I can see there were a lot of updates to the types.ts file so will need a clean slate to rename to include .d.ts again

@omonk
Copy link
Contributor Author

omonk commented Dec 23, 2025

Right that should be fixed now...

Regarding the failing pipelines, it's working fine on my local. I wanted to try and replicate the node version but messed around with the branch before and Github has removed the historical CI runs.

image image

Node version v22.21.0
yarn version 1.22.1

@omonk
Copy link
Contributor Author

omonk commented Dec 23, 2025

regarding the other change from the docusaurus types package, the suggested path does not exist in the dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewing 👀 Undergoing manual audit to determine if issue should still be active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants