diff --git a/package.json b/package.json index 95e3a7c..1448901 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/prefetch.ts b/src/prefetch.ts index f4a47f4..6af7697 100644 --- a/src/prefetch.ts +++ b/src/prefetch.ts @@ -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' &&