Last active
May 14, 2023 11:28
-
-
Save bkrmendy/f4582173f50fab209ddfef1377ab31e3 to your computer and use it in GitHub Desktop.
eyedropper.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ColorSelectionOptions { | |
signal?: AbortSignal | |
} | |
interface ColorSelectionResult { | |
sRGBHex: string | |
} | |
interface EyeDropper { | |
open: (options?: ColorSelectionOptions) => Promise<ColorSelectionResult> | |
} | |
interface EyeDropperConstructor { | |
new (): EyeDropper | |
} | |
interface Window { | |
EyeDropper?: EyeDropperConstructor | undefined | |
} |
Thanks! I've updated the gist to reflect your changes. Hopefully we'll get official support for this soon.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just a note that this is typed incorrectly -
EyeDropper
should not extendEyeDropperConstructor
.that allows you to do some incorrect things:
instead, Window.EyeDropper should be set to
EyeDropperConstructor
.(i've also removed the default parameter for options, as they shouldn't be provided when defining a type, and marked signal as optional)