iabtcf-es
iabtcf-es copied to clipboard
__tcfapi type definitions
I am looking for official TypeScript type definitions for the window.__tcfapi
.
The official repos provide types that allow any string to be passed as command, but I believe this is not sufficient enough.
To my understanding there is a base API with specific commands that I would like to use in a type safe way, eg. something like
declare function TcfApi(
command: 'addEventListener',
version: 2,
callback: (tcData: TCData, success: boolean) => void,
): void;
declare function TcfApi(
command: 'removeEventListener',
version: 2,
callback: (success: boolean) => void,
listenerId?: number,
): void;
declare global {
interface Window {
__tcfapi: typeof TcfApi;
}
}
Also, they are difficult to access, as discussed in https://github.com/InteractiveAdvertisingBureau/iabtcf-es/issues/172
There are many custom implementations out, like from The Guardian or Spring Media, but I think it would be great to have an official resource for this, that can be relied upon as being accurate
Any comment from the maintainers if this is something that could be part of a roadmap? I have been working on three of the major German news websites and all of them need this.
cc @shortaflip
Hi @LukasBombach,
If you would like to create a PR for an implementation of your proposal, I can have it reviewed.
@LukasBombach Do you create a PR or can we close this issue?
Hey sorry, my dayjob and two kids are too much, can't really get to this