🏷 bring back Navigator.connection type to fix tsc error temporary

This commit is contained in:
Kuitos 2022-08-26 14:51:30 +08:00
parent 96d2e57f73
commit e9e492ba8e
2 changed files with 11 additions and 1 deletions

View File

@ -125,7 +125,7 @@
"prettier": "^2.1.2",
"rimraf": "^3.0.0",
"ts-jest": "^25.2.1",
"typescript": "^4.1.2",
"typescript": "^4.8.2",
"umi-plugin-hire": "^1.0.3"
}
}

View File

@ -31,6 +31,16 @@ const requestIdleCallback =
}, 1);
};
declare global {
interface Navigator {
connection: {
saveData: boolean;
effectiveType: string;
type: 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
};
}
}
const isSlowNetwork = navigator.connection
? navigator.connection.saveData ||
(navigator.connection.type !== 'wifi' &&