🏷 upgrade typing to follow latest ts version (#1675)
This commit is contained in:
parent
9b769f224c
commit
84486daa4b
|
|
@ -9,31 +9,10 @@ import { isFunction } from 'lodash';
|
||||||
import { getAppStatus, getMountedApps, NOT_LOADED } from 'single-spa';
|
import { getAppStatus, getMountedApps, NOT_LOADED } from 'single-spa';
|
||||||
import type { AppMetadata, PrefetchStrategy } from './interfaces';
|
import type { AppMetadata, PrefetchStrategy } from './interfaces';
|
||||||
|
|
||||||
type RequestIdleCallbackHandle = any;
|
|
||||||
type RequestIdleCallbackOptions = {
|
|
||||||
timeout: number;
|
|
||||||
};
|
|
||||||
type RequestIdleCallbackDeadline = {
|
|
||||||
readonly didTimeout: boolean;
|
|
||||||
timeRemaining: () => number;
|
|
||||||
};
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
interface NetworkInformation {
|
||||||
interface Window {
|
saveData: boolean;
|
||||||
requestIdleCallback: (
|
effectiveType: string;
|
||||||
callback: (deadline: RequestIdleCallbackDeadline) => void,
|
|
||||||
opts?: RequestIdleCallbackOptions,
|
|
||||||
) => RequestIdleCallbackHandle;
|
|
||||||
cancelIdleCallback: (handle: RequestIdleCallbackHandle) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Navigator {
|
|
||||||
connection: {
|
|
||||||
saveData: boolean;
|
|
||||||
effectiveType: string;
|
|
||||||
type: 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,7 +35,7 @@ const isSlowNetwork = navigator.connection
|
||||||
? navigator.connection.saveData ||
|
? navigator.connection.saveData ||
|
||||||
(navigator.connection.type !== 'wifi' &&
|
(navigator.connection.type !== 'wifi' &&
|
||||||
navigator.connection.type !== 'ethernet' &&
|
navigator.connection.type !== 'ethernet' &&
|
||||||
/(2|3)g/.test(navigator.connection.effectiveType))
|
/([23])g/.test(navigator.connection.effectiveType))
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user