Skip to content

Restore Trusted Types from BCD 6.0.24#2074

Draft
saschanaz wants to merge 3 commits into
microsoft:mainfrom
saschanaz:bcd-6024
Draft

Restore Trusted Types from BCD 6.0.24#2074
saschanaz wants to merge 3 commits into
microsoft:mainfrom
saschanaz:bcd-6024

Conversation

@saschanaz

@saschanaz saschanaz commented Jul 19, 2025

Copy link
Copy Markdown
Contributor

Closes #1246

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the PR!

This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged.

@saschanaz

Copy link
Copy Markdown
Contributor Author

Every feedback from #1246 applies here too.

@saschanaz

Copy link
Copy Markdown
Contributor Author

Work item - Trusted* types should be ignored from the getter. And those types need to get the nominal type hack too. (Why in 2025 we still have no official solution for this? 😞)

@saschanaz

saschanaz commented Jul 19, 2025

Copy link
Copy Markdown
Contributor Author

Trusted* types should be ignored from the getter.

This needs TS5.1+ for microsoft/TypeScript#53417. Meaning anyone with pre-5.1 will not be able to assign trusted types without any hack.

Edit: well, given we only have 5.5/5.6 backward-compat types, this effectively means pre-5.5 users would get problems. (I really don't want to add more unless it's super duper required)

@jakebailey

Copy link
Copy Markdown
Member

Oh boy, I wonder how much this conflicts with the existing trusted types that people are using...

@saschanaz

Copy link
Copy Markdown
Contributor Author

Should certainly take a look at https://www.npmjs.com/package/@types/trusted-types?activeTab=code to reduce friction.

@saschanaz

Copy link
Copy Markdown
Contributor Author

Although the library's private brand: true effectively makes it exclusive to any other declaration AFAICT...

@jakebailey

Copy link
Copy Markdown
Member

Although the library's private brand: true effectively makes it exclusive to any other declaration AFAICT...

Yeah, they are declared as classes, and that private brand means they are nominal. I think this is definitely something that needs to be rectified somehow...

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