Skip to content

fix(core): remove some incorrect type assertions #826

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

Merged
merged 2 commits into from
Jun 18, 2025

Conversation

ocavue
Copy link
Contributor

@ocavue ocavue commented Jun 18, 2025

When working on typedoc-plugin-markdown, I found that the members function accepts an undefined model argument during runtime, while the TS types say model must be an array.

After some debugging, I found the reason. model.children here is DeclarationReflection[] | undefined, but it's forced to be asserted as DeclarationReflection[].

I found that type assertions are relatively evaluated and should be avoided if we can. This PR removes some build-time type assertions and replaces them with runtime types.

Copy link

vercel bot commented Jun 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
typedoc-plugin-markdown ⬜️ Ignored (Inspect) Visit Preview Jun 18, 2025 7:49pm

@tgreyuk tgreyuk merged commit b53ca35 into typedoc2md:main Jun 18, 2025
3 checks passed
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