build: TypeScript 3.5 upgrade (#31615)

https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#typescript-35

PR Close #31615
This commit is contained in:
Igor Minar
2019-07-17 17:49:16 -07:00
committed by Miško Hevery
parent 3a2b195a58
commit 6ece7db37a
34 changed files with 196 additions and 65 deletions

View File

@ -14,7 +14,7 @@ import {MessageBus, MessageBusSink, MessageBusSource} from './message_bus';
// TODO(jteplitz602): Replace this with the definition in lib.webworker.d.ts(#3492)
export interface PostMessageTarget {
postMessage: (message: any, transfer?: [ArrayBuffer]) => void;
postMessage: (message: any, transfer?: [Transferable]) => void;
}
export class PostMessageBusSink implements MessageBusSink {

View File

@ -36,7 +36,7 @@ export function errorHandler(): ErrorHandler {
// TODO(jteplitz602): remove this and compile with lib.webworker.d.ts (#3492)
const _postMessage = {
postMessage: (message: any, transferrables?: [ArrayBuffer]) => {
postMessage: (message: any, transferrables: [Transferable]) => {
(<any>postMessage)(message, transferrables);
}
};

View File

@ -171,7 +171,10 @@ function createNgZone(): NgZone {
*/
function spawnWebWorker(uri: string, instance: WebWorkerInstance): void {
const webWorker: Worker = new Worker(uri);
const sink = new PostMessageBusSink(webWorker);
// webWorker is casted to any because the lib.d.ts signature changed in TS3.5 to require the
// transfer argument in postMessage method.
// this seems wrong but since all of this code is deprecated it shouldn't matter that much.
const sink = new PostMessageBusSink(webWorker as any);
const source = new PostMessageBusSource(webWorker);
const bus = new PostMessageBus(sink, source);

View File

@ -32,5 +32,5 @@ class MockPostMessage {
}
}
postMessage(data: any, transfer?: [ArrayBuffer]): void { this._listener(<any>{data: data}); }
postMessage(data: any, transfer?: [Transferable]): void { this._listener(<any>{data: data}); }
}