Skip to content

chore: add typings and remove placeholders #1175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

sserrata
Copy link
Member

Summary

  • add official @types packages for Postman collection and React modal
  • remove hand-rolled module declarations
  • update imports to match new typings
  • clean up request handling code and fix type issues

Testing

  • yarn lint
  • yarn test
  • yarn build-packages

https://chatgpt.com/codex/tasks/task_e_685ed9dd8f8c832398f0bd2341655ec2

@sserrata sserrata self-assigned this Jun 27, 2025
@sserrata sserrata added the chore label Jun 27, 2025
Copy link

Visit the preview URL for this PR (updated for commit 6d1ed20):

https://docusaurus-openapi-36b86--pr1175-5ben620x.web.app

(expires Sun, 27 Jul 2025 18:20:04 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@sserrata
Copy link
Member Author

The latest commit removes custom placeholder typings and relies on official @types packages instead. Imports throughout the theme now use the typed Postman Collection module:

import { Collection } from "postman-collection";
import * as sdk from "postman-collection";

The code snippets component was updated similarly:

import codegen from "postman-code-generators";
import * as sdk from "postman-collection";

ApiExplorer instantiates Postman requests defensively using these types:

const postman = new sdk.Request(
  item.postman ? (item.postman as any).toJSON() : {}
);

Form‑data handling in makeRequest now fetches members safely:

const members = (request.body as any)?.formdata?.members;
if (Array.isArray(members)) {
  for (const data of members) {
    ...
  }
}

Query parameter building converts values to strings to satisfy typings:

new sdk.QueryParam({
  key: `${param.name}[${key}]`,
  value: String(val),
})

Cookie construction also specifies empty domain and path fields:

new sdk.Cookie({
  key: key,
  value: String(val),
  domain: "",
  path: "",
})

Placeholder declaration files (postman-collection.d.ts, react-modal.d.ts, and theme-translations.d.ts) were deleted, and @types/postman-collection and @types/react-modal were added to package.json:

"@types/postman-collection": "^3.5.11",
"@types/react-modal": "^3.16.3",

These changes ensure that code relying on Postman and React Modal APIs benefits from real type definitions, improving editor tooling, compilation safety, and future maintainability.

@sserrata sserrata merged commit b251ee3 into PaloAltoNetworks:main Jun 27, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant