From bbada16c2b8110afabc6610edda5ccbb9856f9be Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 19 Dec 2017 11:08:08 +0900 Subject: [PATCH 1/2] no need to trim ...as all callers trim if needed --- TS.fsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TS.fsx b/TS.fsx index ebb327fd1..e0394c763 100644 --- a/TS.fsx +++ b/TS.fsx @@ -693,7 +693,7 @@ module Emit = /// Get typescript type using object dom type, object name, and it's associated interface name let rec DomTypeToTsType (objDomType: string) = - match objDomType.Trim('?') with + match objDomType with | "AbortMode" -> "String" | "any" -> "any" | "bool" | "boolean" | "Boolean" -> "boolean" From 048c8bd0c2d47b5c234f47a4490b2e236d11688b Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 19 Dec 2017 11:08:57 +0900 Subject: [PATCH 2/2] process BufferSource correctly --- TS.fsx | 6 +----- baselines/dom.generated.d.ts | 24 ++++++++++++------------ baselines/webworker.generated.d.ts | 10 +++++----- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/TS.fsx b/TS.fsx index e0394c763..68099763a 100644 --- a/TS.fsx +++ b/TS.fsx @@ -695,23 +695,19 @@ module Emit = let rec DomTypeToTsType (objDomType: string) = match objDomType with | "AbortMode" -> "String" - | "any" -> "any" | "bool" | "boolean" | "Boolean" -> "boolean" | "CanvasPixelArray" -> "number[]" - | "Date" -> "Date" | "DOMHighResTimeStamp" -> "number" | "DOMString" -> "string" | "DOMTimeStamp" -> "number" | "EndOfStreamError" -> "number" | "EventListener" -> "EventListenerOrEventListenerObject" | "double" | "float" -> "number" - | "Function" -> "Function" | "object" -> "any" - | "Promise" -> "Promise" | "ReadyState" -> "string" | "sequence" -> "Array" | "UnrestrictedDouble" | "unrestricted double" -> "number" - | "void" -> "void" + | "any" | "BufferSource" | "Date" | "Function" | "Promise" | "void" -> objDomType | integerType when List.contains integerType integerTypes -> "number" | extendedType when List.contains extendedType extendedTypes -> extendedType | _ -> diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 6af3fa54d..b6fd9f38e 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -761,7 +761,7 @@ interface ProgressEventInit extends EventInit { } interface PushSubscriptionOptionsInit { - applicationServerKey?: any; + applicationServerKey?: BufferSource | null; userVisibleOnly?: boolean; } @@ -770,7 +770,7 @@ interface RegistrationOptions { } interface RequestInit { - body?: any; + body?: Blob | BufferSource | FormData | string | null; cache?: RequestCache; credentials?: RequestCredentials; headers?: HeadersInit; @@ -1088,7 +1088,7 @@ interface RTCTransportStats extends RTCStats { } interface ScopedCredentialDescriptor { - id: any; + id: BufferSource; transports?: Transport[]; type: ScopedCredentialType; } @@ -7540,7 +7540,7 @@ declare var MediaKeyMessageEvent: { interface MediaKeys { createSession(sessionType?: MediaKeySessionType): MediaKeySession; - setServerCertificate(serverCertificate: any): Promise; + setServerCertificate(serverCertificate: BufferSource): Promise; } declare var MediaKeys: { @@ -7554,10 +7554,10 @@ interface MediaKeySession extends EventTarget { readonly keyStatuses: MediaKeyStatusMap; readonly sessionId: string; close(): Promise; - generateRequest(initDataType: string, initData: any): Promise; + generateRequest(initDataType: string, initData: BufferSource): Promise; load(sessionId: string): Promise; remove(): Promise; - update(response: any): Promise; + update(response: BufferSource): Promise; } declare var MediaKeySession: { @@ -7568,8 +7568,8 @@ declare var MediaKeySession: { interface MediaKeyStatusMap { readonly size: number; forEach(callback: ForEachCallback): void; - get(keyId: any): MediaKeyStatus; - has(keyId: any): boolean; + get(keyId: BufferSource): MediaKeyStatus; + has(keyId: BufferSource): boolean; } declare var MediaKeyStatusMap: { @@ -12307,8 +12307,8 @@ declare var WaveShaperNode: { }; interface WebAuthentication { - getAssertion(assertionChallenge: any, options?: AssertionOptions): Promise; - makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: any, options?: ScopedCredentialOptions): Promise; + getAssertion(assertionChallenge: BufferSource, options?: AssertionOptions): Promise; + makeCredential(accountInformation: Account, cryptoParameters: ScopedCredentialParameters[], attestationChallenge: BufferSource, options?: ScopedCredentialOptions): Promise; } declare var WebAuthentication: { @@ -14797,7 +14797,7 @@ interface ErrorEventHandler { (message: string, filename?: string, lineno?: number, colno?: number, error?: Error): void; } interface ForEachCallback { - (keyId: any, status: MediaKeyStatus): void; + (keyId: BufferSource, status: MediaKeyStatus): void; } interface FrameRequestCallback { (time: number): void; @@ -15253,7 +15253,7 @@ declare function removeEventListener(type: K, li declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; type AAGUID = string; type AlgorithmIdentifier = string | Algorithm; -type BodyInit = any; +type BodyInit = Blob | BufferSource | FormData | string; type ByteString = string; type ConstrainBoolean = boolean | ConstrainBooleanParameters; type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index d3e2a5764..3453cb323 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -66,12 +66,12 @@ interface ObjectURLOptions { } interface PushSubscriptionOptionsInit { - applicationServerKey?: any; + applicationServerKey?: BufferSource | null; userVisibleOnly?: boolean; } interface RequestInit { - body?: any; + body?: Blob | BufferSource | FormData | string | null; cache?: RequestCache; credentials?: RequestCredentials; headers?: HeadersInit; @@ -119,7 +119,7 @@ interface NotificationEventInit extends ExtendableEventInit { } interface PushEventInit extends ExtendableEventInit { - data?: any; + data?: BufferSource | USVString; } interface SyncEventInit extends ExtendableEventInit { @@ -1834,7 +1834,7 @@ interface ErrorEventHandler { (message: string, filename?: string, lineno?: number, colno?: number, error?: Error): void; } interface ForEachCallback { - (keyId: any, status: MediaKeyStatus): void; + (keyId: BufferSource, status: MediaKeyStatus): void; } interface FunctionStringCallback { (data: string): void; @@ -1884,7 +1884,7 @@ declare function addEventListener(type: string, listener: EventListenerOrEventLi declare function removeEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; type AlgorithmIdentifier = string | Algorithm; -type BodyInit = any; +type BodyInit = Blob | BufferSource | FormData | string; type IDBKeyPath = string; type RequestInfo = Request | string; type USVString = string;