Update to Prettier 2 and use ES Private Fields (#4498)

This commit is contained in:
Kitson Kelly 2020-03-29 04:03:49 +11:00 committed by GitHub
parent 1397b8e0e7
commit bced52505f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
329 changed files with 2787 additions and 2430 deletions

View file

@ -223,7 +223,7 @@ export function createAlgorithmFromUnderlyingMethod<
if (typeof method !== "function") {
throw new TypeError(`Field "${methodName}" is not a function.`);
}
return function(...fnArgs: any[]): any {
return function (...fnArgs: any[]): any {
return promiseCall(method, obj, fnArgs.concat(extraArgs));
};
}
@ -252,7 +252,7 @@ export function makeSizeAlgorithmFromSizeFunction<T>(
if (typeof sizeFn !== "function" && typeof sizeFn !== "undefined") {
throw new TypeError("size function must be undefined or a function");
}
return function(chunk: T): number {
return function (chunk: T): number {
if (typeof sizeFn === "function") {
return sizeFn(chunk);
}
@ -265,7 +265,7 @@ export function makeSizeAlgorithmFromSizeFunction<T>(
export const enum ControlledPromiseState {
Pending,
Resolved,
Rejected
Rejected,
}
export interface ControlledPromise<V> {
@ -277,14 +277,14 @@ export interface ControlledPromise<V> {
export function createControlledPromise<V>(): ControlledPromise<V> {
const conProm = {
state: ControlledPromiseState.Pending
state: ControlledPromiseState.Pending,
} as ControlledPromise<V>;
conProm.promise = new Promise<V>(function(resolve, reject) {
conProm.resolve = function(v?: V): void {
conProm.promise = new Promise<V>(function (resolve, reject) {
conProm.resolve = function (v?: V): void {
conProm.state = ControlledPromiseState.Resolved;
resolve(v);
};
conProm.reject = function(e?: ErrorResult): void {
conProm.reject = function (e?: ErrorResult): void {
conProm.state = ControlledPromiseState.Rejected;
reject(e);
};