mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
feat(webidl‑conversions): Update to v5.0 (#41006)
* feat(webidl‑conversions): Update to v5.0 * test(webidl‑conversions): Work around TS ≤3.5 bug * test(webidl‑conversions): Fix tests on TS ≤3.5
This commit is contained in:
Vendored
+2
-4
@@ -1,4 +1,4 @@
|
||||
// Type definitions for webidl-conversions 4.0
|
||||
// Type definitions for webidl-conversions 5.0
|
||||
// Project: https://github.com/jsdom/webidl-conversions#readme
|
||||
// Definitions by: ExE Boss <https://github.com/ExE-Boss>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -52,9 +52,7 @@ declare const WebIDLConversions: {
|
||||
ByteString(V: any, opts?: WebIDLConversions.StringOptions): string;
|
||||
USVString(V: any, opts?: WebIDLConversions.StringOptions): string;
|
||||
|
||||
object(V: any, opts?: WebIDLConversions.Options): object;
|
||||
Error(V: any, opts?: WebIDLConversions.Options): Error;
|
||||
|
||||
object<V>(V: V, opts?: WebIDLConversions.Options): V extends object ? V : V & object;
|
||||
ArrayBuffer(V: any, opts?: WebIDLConversions.Options): ArrayBuffer;
|
||||
DataView(V: any, opts?: WebIDLConversions.Options): DataView;
|
||||
|
||||
|
||||
@@ -7,6 +7,12 @@ const options: conversions.Options = ((): conversions.Options => {
|
||||
return {};
|
||||
})();
|
||||
|
||||
/**
|
||||
* The `expectType` function from https://www.npmjs.com/package/tsd,
|
||||
* except instead of returning `void`, it returns `T`.
|
||||
*/
|
||||
declare function expectType<T>(value: T): T;
|
||||
|
||||
conversions.any(any); // $ExpectType any
|
||||
conversions.any(unknown); // $ExpectType unknown
|
||||
conversions.any(options); // $ExpectType Options
|
||||
@@ -38,8 +44,12 @@ conversions.DOMString(any, options); // $ExpectType string
|
||||
conversions.ByteString(any, options); // $ExpectType string
|
||||
conversions.USVString(any, options); // $ExpectType string
|
||||
|
||||
conversions.object(any, options); // $ExpectType object
|
||||
conversions.Error(any, options); // $ExpectType Error
|
||||
conversions.object(any, options); // $ExpectType any
|
||||
conversions.object(unknown, options); // $ExpectType object
|
||||
expectType<null & object>(conversions.object(null, options));
|
||||
expectType<string & object>(conversions.object('string', options));
|
||||
expectType<number & object>(conversions.object(123, options));
|
||||
conversions.object({}, options); // $ExpectType {}
|
||||
|
||||
conversions.ArrayBuffer(any, options); // $ExpectType ArrayBuffer
|
||||
conversions.DataView(any, options); // $ExpectType DataView
|
||||
|
||||
Reference in New Issue
Block a user