Skip to content

Process BufferSource correctly #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions TS.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -693,25 +693,21 @@ 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"
| "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
| _ ->
Expand Down
24 changes: 12 additions & 12 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ interface ProgressEventInit extends EventInit {
}

interface PushSubscriptionOptionsInit {
applicationServerKey?: any;
applicationServerKey?: BufferSource | null;
userVisibleOnly?: boolean;
}

Expand All @@ -771,7 +771,7 @@ interface RegistrationOptions {

interface RequestInit {
signal?: AbortSignal;
body?: any;
body?: Blob | BufferSource | FormData | string | null;
cache?: RequestCache;
credentials?: RequestCredentials;
headers?: HeadersInit;
Expand Down Expand Up @@ -1089,7 +1089,7 @@ interface RTCTransportStats extends RTCStats {
}

interface ScopedCredentialDescriptor {
id: any;
id: BufferSource;
transports?: Transport[];
type: ScopedCredentialType;
}
Expand Down Expand Up @@ -7543,7 +7543,7 @@ declare var MediaKeyMessageEvent: {

interface MediaKeys {
createSession(sessionType?: MediaKeySessionType): MediaKeySession;
setServerCertificate(serverCertificate: any): Promise<void>;
setServerCertificate(serverCertificate: BufferSource): Promise<void>;
}

declare var MediaKeys: {
Expand All @@ -7557,10 +7557,10 @@ interface MediaKeySession extends EventTarget {
readonly keyStatuses: MediaKeyStatusMap;
readonly sessionId: string;
close(): Promise<void>;
generateRequest(initDataType: string, initData: any): Promise<void>;
generateRequest(initDataType: string, initData: BufferSource): Promise<void>;
load(sessionId: string): Promise<boolean>;
remove(): Promise<void>;
update(response: any): Promise<void>;
update(response: BufferSource): Promise<void>;
}

declare var MediaKeySession: {
Expand All @@ -7571,8 +7571,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: {
Expand Down Expand Up @@ -12311,8 +12311,8 @@ declare var WaveShaperNode: {
};

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

declare var WebAuthentication: {
Expand Down Expand Up @@ -14816,7 +14816,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;
Expand Down Expand Up @@ -15272,7 +15272,7 @@ declare function removeEventListener<K extends keyof WindowEventMap>(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;
Expand Down
10 changes: 5 additions & 5 deletions baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ interface ObjectURLOptions {
}

interface PushSubscriptionOptionsInit {
applicationServerKey?: any;
applicationServerKey?: BufferSource | null;
userVisibleOnly?: boolean;
}

interface RequestInit {
signal?: AbortSignal;
body?: any;
body?: Blob | BufferSource | FormData | string | null;
cache?: RequestCache;
credentials?: RequestCredentials;
headers?: HeadersInit;
Expand Down Expand Up @@ -120,7 +120,7 @@ interface NotificationEventInit extends ExtendableEventInit {
}

interface PushEventInit extends ExtendableEventInit {
data?: any;
data?: BufferSource | USVString;
}

interface SyncEventInit extends ExtendableEventInit {
Expand Down Expand Up @@ -1851,7 +1851,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;
Expand Down Expand Up @@ -1901,7 +1901,7 @@ declare function addEventListener(type: string, listener: EventListenerOrEventLi
declare function removeEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(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;
Expand Down