Skip to content
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

feat(dts): expose ts compiler errors #278

Merged
merged 1 commit into from
Dec 27, 2024
Merged

feat(dts): expose ts compiler errors #278

merged 1 commit into from
Dec 27, 2024

Conversation

danielroe
Copy link
Member

It's possible for compiler errors to occur when processing individual declarations - this causes empty files which will (silently) break builds.

This exposes an errors object which can be handled by builders like unbuild to throw an error and fail the build in this case, if so configured. (It does not change default behaviour.)

While debugging, I removed the incorrect incremental compiler option and added the more permissive allowImportingTsExtensions.

@danielroe danielroe requested review from pi0 and Copilot December 26, 2024 21:03
@danielroe danielroe self-assigned this Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

src/utils/dts.ts:17

  • [nitpick] The property name 'errors' is ambiguous. Consider renaming it to 'compilerErrors' to avoid confusion.
{ contents: string; errors?: Error[] }

src/utils/dts.ts:116

  • The 'TypeError' constructor is being used incorrectly. The 'TypeError' constructor does not accept an options object with a 'cause' property. Consider using a custom error class or another approach to include the diagnostic information.
new TypeError(ts.formatDiagnostics([diagnostic], tsHost), { cause: diagnostic })
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@pi0 pi0 merged commit d7819d9 into main Dec 27, 2024
2 checks passed
@pi0 pi0 deleted the feat/expose-dts-errors branch December 27, 2024 06:56
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