Skip to content

Commit a611f5e

Browse files
authored
Merge pull request #343 from saschanaz/buffersource
Process BufferSource correctly
2 parents 945e4c5 + 07bd5d4 commit a611f5e

File tree

3 files changed

+19
-23
lines changed

3 files changed

+19
-23
lines changed

TS.fsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -693,25 +693,21 @@ module Emit =
693693

694694
/// Get typescript type using object dom type, object name, and it's associated interface name
695695
let rec DomTypeToTsType (objDomType: string) =
696-
match objDomType.Trim('?') with
696+
match objDomType with
697697
| "AbortMode" -> "String"
698-
| "any" -> "any"
699698
| "bool" | "boolean" | "Boolean" -> "boolean"
700699
| "CanvasPixelArray" -> "number[]"
701-
| "Date" -> "Date"
702700
| "DOMHighResTimeStamp" -> "number"
703701
| "DOMString" -> "string"
704702
| "DOMTimeStamp" -> "number"
705703
| "EndOfStreamError" -> "number"
706704
| "EventListener" -> "EventListenerOrEventListenerObject"
707705
| "double" | "float" -> "number"
708-
| "Function" -> "Function"
709706
| "object" -> "any"
710-
| "Promise" -> "Promise"
711707
| "ReadyState" -> "string"
712708
| "sequence" -> "Array"
713709
| "UnrestrictedDouble" | "unrestricted double" -> "number"
714-
| "void" -> "void"
710+
| "any" | "BufferSource" | "Date" | "Function" | "Promise" | "void" -> objDomType
715711
| integerType when List.contains integerType integerTypes -> "number"
716712
| extendedType when List.contains extendedType extendedTypes -> extendedType
717713
| _ ->

baselines/dom.generated.d.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ interface ProgressEventInit extends EventInit {
761761
}
762762

763763
interface PushSubscriptionOptionsInit {
764-
applicationServerKey?: any;
764+
applicationServerKey?: BufferSource | null;
765765
userVisibleOnly?: boolean;
766766
}
767767

@@ -771,7 +771,7 @@ interface RegistrationOptions {
771771

772772
interface RequestInit {
773773
signal?: AbortSignal;
774-
body?: any;
774+
body?: Blob | BufferSource | FormData | string | null;
775775
cache?: RequestCache;
776776
credentials?: RequestCredentials;
777777
headers?: HeadersInit;
@@ -1089,7 +1089,7 @@ interface RTCTransportStats extends RTCStats {
10891089
}
10901090

10911091
interface ScopedCredentialDescriptor {
1092-
id: any;
1092+
id: BufferSource;
10931093
transports?: Transport[];
10941094
type: ScopedCredentialType;
10951095
}
@@ -7544,7 +7544,7 @@ declare var MediaKeyMessageEvent: {
75447544

75457545
interface MediaKeys {
75467546
createSession(sessionType?: MediaKeySessionType): MediaKeySession;
7547-
setServerCertificate(serverCertificate: any): Promise<void>;
7547+
setServerCertificate(serverCertificate: BufferSource): Promise<void>;
75487548
}
75497549

75507550
declare var MediaKeys: {
@@ -7558,10 +7558,10 @@ interface MediaKeySession extends EventTarget {
75587558
readonly keyStatuses: MediaKeyStatusMap;
75597559
readonly sessionId: string;
75607560
close(): Promise<void>;
7561-
generateRequest(initDataType: string, initData: any): Promise<void>;
7561+
generateRequest(initDataType: string, initData: BufferSource): Promise<void>;
75627562
load(sessionId: string): Promise<boolean>;
75637563
remove(): Promise<void>;
7564-
update(response: any): Promise<void>;
7564+
update(response: BufferSource): Promise<void>;
75657565
}
75667566

75677567
declare var MediaKeySession: {
@@ -7572,8 +7572,8 @@ declare var MediaKeySession: {
75727572
interface MediaKeyStatusMap {
75737573
readonly size: number;
75747574
forEach(callback: ForEachCallback): void;
7575-
get(keyId: any): MediaKeyStatus;
7576-
has(keyId: any): boolean;
7575+
get(keyId: BufferSource): MediaKeyStatus;
7576+
has(keyId: BufferSource): boolean;
75777577
}
75787578

75797579
declare var MediaKeyStatusMap: {
@@ -12312,8 +12312,8 @@ declare var WaveShaperNode: {
1231212312
};
1231312313

1231412314
interface WebAuthentication {
12315-
getAssertion(assertionChallenge: any, options?: AssertionOptions): Promise<WebAuthnAssertion>;
12316-
makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): Promise<ScopedCredentialInfo>;
12315+
getAssertion(assertionChallenge: BufferSource, options?: AssertionOptions): Promise<WebAuthnAssertion>;
12316+
makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: BufferSource, options?: ScopedCredentialOptions): Promise<ScopedCredentialInfo>;
1231712317
}
1231812318

1231912319
declare var WebAuthentication: {
@@ -14853,7 +14853,7 @@ interface ErrorEventHandler {
1485314853
(message: string, filename?: string, lineno?: number, colno?: number, error?: Error): void;
1485414854
}
1485514855
interface ForEachCallback {
14856-
(keyId: any, status: MediaKeyStatus): void;
14856+
(keyId: BufferSource, status: MediaKeyStatus): void;
1485714857
}
1485814858
interface FrameRequestCallback {
1485914859
(time: number): void;
@@ -15309,7 +15309,7 @@ declare function removeEventListener<K extends keyof WindowEventMap>(type: K, li
1530915309
declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1531015310
type AAGUID = string;
1531115311
type AlgorithmIdentifier = string | Algorithm;
15312-
type BodyInit = any;
15312+
type BodyInit = Blob | BufferSource | FormData | string;
1531315313
type ByteString = string;
1531415314
type ConstrainBoolean = boolean | ConstrainBooleanParameters;
1531515315
type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;

baselines/webworker.generated.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ interface ObjectURLOptions {
6666
}
6767

6868
interface PushSubscriptionOptionsInit {
69-
applicationServerKey?: any;
69+
applicationServerKey?: BufferSource | null;
7070
userVisibleOnly?: boolean;
7171
}
7272

7373
interface RequestInit {
7474
signal?: AbortSignal;
75-
body?: any;
75+
body?: Blob | BufferSource | FormData | string | null;
7676
cache?: RequestCache;
7777
credentials?: RequestCredentials;
7878
headers?: HeadersInit;
@@ -120,7 +120,7 @@ interface NotificationEventInit extends ExtendableEventInit {
120120
}
121121

122122
interface PushEventInit extends ExtendableEventInit {
123-
data?: any;
123+
data?: BufferSource | USVString;
124124
}
125125

126126
interface SyncEventInit extends ExtendableEventInit {
@@ -1851,7 +1851,7 @@ interface ErrorEventHandler {
18511851
(message: string, filename?: string, lineno?: number, colno?: number, error?: Error): void;
18521852
}
18531853
interface ForEachCallback {
1854-
(keyId: any, status: MediaKeyStatus): void;
1854+
(keyId: BufferSource, status: MediaKeyStatus): void;
18551855
}
18561856
interface FunctionStringCallback {
18571857
(data: string): void;
@@ -1901,7 +1901,7 @@ declare function addEventListener(type: string, listener: EventListenerOrEventLi
19011901
declare function removeEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
19021902
declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
19031903
type AlgorithmIdentifier = string | Algorithm;
1904-
type BodyInit = any;
1904+
type BodyInit = Blob | BufferSource | FormData | string;
19051905
type IDBKeyPath = string;
19061906
type RequestInfo = Request | string;
19071907
type USVString = string;

0 commit comments

Comments
 (0)