Skip to content

Conversation

@mathe42
Copy link
Contributor

@mathe42 mathe42 commented Aug 14, 2022

This is a try to fix #1197. This might not the optimal solution!

I simply checked for all Interfaces if they have the Transferable attribute and added it to the addedItems object where it was defined before.

This is my first code-contribution here so there might be things that I missed.

@github-actions
Copy link
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.

@ExE-Boss
Copy link
Contributor

I think that this should use a similar implementation to ArrayBufferLike1:

/**
 * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays.
 */
interface ArrayBufferTypes {
	ArrayBuffer: ArrayBuffer;
}
type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes];

Footnotes

  1. https://github.com/microsoft/TypeScript/blob/03b12a6a45ca0dc043896160fd81060a980352d9/lib/lib.es5.d.ts#L1586-L1592

@mathe42
Copy link
Contributor Author

mathe42 commented Aug 14, 2022

That is a good solution for ArrayBufferLike as this can be extended (as it is a ES-Syntax-Thing) by the runtime (Browser, Node, Deno) with for example SharedArrayBuffer but Transferable is a Web-Feature that doesn't need to be extended. (Yes NodeJS and Deno adopt Transferable but they have theire own types independent from @types/web).


TL;DR: As this is nothing a user / runtime can extend. I prefere to keep it as it currently is.

@saschanaz
Copy link
Contributor

This is an interesting approach! I thought I'd do it in emitter but this looks better than playing manually with strings.

LGTM

@github-actions github-actions bot merged commit 85672cd into microsoft:main Aug 18, 2022
@github-actions
Copy link
Contributor

Merging because @saschanaz is a code-owner of all the changes - thanks!

@HolgerJeromin
Copy link
Contributor

Should this list be sorted to have a stable output?

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.

Autogenerate type Transferable

4 participants