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

Add triple-slash types reference to trusted-types. #1036

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

reduckted
Copy link
Contributor

@reduckted reduckted commented Nov 26, 2024

Summary

Fixes #1035.

We need to tell TypeScript that we use the type declarations from trusted-types. This is done using a triple-slash directive. Without this, the references to trusted-types in the type declaration file can cause compilation errors for certain configurations.

I initially added /// <reference types="trusted-types" preserve="true"/> to the top of purify.ts. Doing that resulted in the triple-slash directive being included in the type declaration files as expected, but it also ended up in the compiled JavaScript, but not at the top of the file (I think due to Rollup combining files together). To keep those files clean I've opted to add this directive via the fix-types.js script (previously called fix-cjs-types.js).

I've also installed @types/node as a dev dependency so that fix-types.js can have type checking performed to help avoid any mistakes when editing that file.

@cure53
Copy link
Owner

cure53 commented Nov 26, 2024

Thanks a ton, again! 🙇

@cure53 cure53 merged commit cea034c into cure53:main Nov 26, 2024
8 checks passed
@reduckted reduckted deleted the feature/trusted-types branch November 26, 2024 21:59
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.

Compile of Angular app not possible since update to v3.2.x
2 participants