diff options
author | Anonymous <65428781+00ff0000red@users.noreply.github.com> | 2021-02-15 15:13:46 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 00:13:46 +0100 |
commit | a6beab824815cededf0ba9fc7904d3b00fde75e4 (patch) | |
tree | 431c5b47a186be5e7464194ed7e1fb839be4d286 /op_crates/web/internal.d.ts | |
parent | 0cf952e7fbcabb90b0b9999eabd12d22a458f933 (diff) |
chore: add internal webidl helpers for enums and nullables (#9504)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Diffstat (limited to 'op_crates/web/internal.d.ts')
-rw-r--r-- | op_crates/web/internal.d.ts | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/op_crates/web/internal.d.ts b/op_crates/web/internal.d.ts index 6f6849a7e..04fc061bb 100644 --- a/op_crates/web/internal.d.ts +++ b/op_crates/web/internal.d.ts @@ -209,13 +209,28 @@ declare namespace globalThis { required?: boolean; } - /**ie - * Assert that the a function has at least a required amount of arguments. + /** + * Create a converter for dictionaries. */ declare function createDictionaryConverter<T>( name: string, ...dictionaries: Dictionary[] ): (v: any, opts: ValueConverterOpts) => T; + + /** + * Create a converter for enums. + */ + declare function createEnumConverter( + name: string, + values: string[], + ): (v: any, opts: ValueConverterOpts) => string; + + /** + * Create a converter that makes the contained type nullable. + */ + declare function createNullableConverter<T>( + converter: (v: any, opts: ValueConverterOpts) => T, + ): (v: any, opts: ValueConverterOpts) => T | null; } declare var url: { |