Use @types/web instead of TS-provided "dom" types

pull/9803/head
Benedikt Werner 2021-09-15 05:04:32 +02:00
parent 8073dc43c7
commit b0201a63d1
No known key found for this signature in database
GPG Key ID: 1DBFF0F8E9E121EB
50 changed files with 64 additions and 26 deletions

View File

@ -26,6 +26,7 @@
"xml2js": "0.4.23"
},
"devDependencies": {
"@types/web": "=0.0.32",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"eslint": "^7.32.0",

View File

@ -10,6 +10,7 @@
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-typescript": "^8.2.5",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"rollup-plugin-terser": "^7.0.2",
"tslib": "^2.3.1",

View File

@ -18,6 +18,7 @@
"@types/debounce-promise": "^3.1.4",
"@types/highcharts": "=4.2.57",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"@types/yaireo__tagify": "^4.7",
"highcharts": "=4.2.5",
"prop-types": "^15.7.2",

View File

@ -22,6 +22,7 @@
"devDependencies": {
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"typescript": "^4.4.3"
},
"dependencies": {

View File

@ -3,6 +3,6 @@
"include": ["src"],
"compilerOptions": {
"outDir": "./dist",
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
}
}

View File

@ -12,6 +12,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -22,6 +22,7 @@
"@build/rollupProject": "2.0.0",
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
}

View File

@ -3,6 +3,6 @@
"include": ["src"],
"compilerOptions": {
"outDir": "./dist",
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
}
}

View File

@ -35,6 +35,7 @@
},
"devDependencies": {
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"typescript": "^4.4.3"
}
}

View File

@ -11,6 +11,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -36,6 +36,7 @@
"@types/cash": "8.0.0",
"@types/dom-screen-wake-lock": "1.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"typescript": "^4.4.3"
}
}

View File

@ -4,6 +4,6 @@
"exclude": [],
"compilerOptions": {
"outDir": "./dist",
"types": ["lichess", "cash", "dom-screen-wake-lock"]
"types": ["lichess", "web", "cash", "dom-screen-wake-lock"]
}
}

View File

@ -13,6 +13,7 @@
"@build/rollupProject": "2.0.0",
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -1,6 +1,6 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
}
}

View File

@ -8,6 +8,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -48,7 +48,7 @@ export default function (token: string) {
console.warn('JSON Object for Speech Keywords seems incomplete. Using English default.');
}
} catch (error) {
console.error('Invalid JSON Object for Speech Keywords. Using English default. ' + Error(error).message);
console.error('Invalid JSON Object for Speech Keywords. Using English default. ' + error);
}
//Lichess Integration with Board API
@ -250,7 +250,7 @@ export default function (token: string) {
connectToGameStream(data.game.id);
} catch (error) {
//This will trigger if connectToGameStream fails
console.error('connectToEventStream - Failed to connect to game stream. ' + Error(error).message);
console.error('connectToEventStream - Failed to connect to game stream. ' + error);
}
} else if (data.type == 'challenge') {
//Challenge received
@ -262,7 +262,7 @@ export default function (token: string) {
console.warn('connectToEventStream - ' + data.error);
}
} catch (error) {
console.error('connectToEventStream - Unable to parse JSON or Unexpected error. ' + Error(error).message);
console.error('connectToEventStream - Unable to parse JSON or Unexpected error. ' + error);
}
} else {
//Signal that some empty message arrived. This is normal to keep the connection alive.
@ -374,7 +374,7 @@ export default function (token: string) {
console.log('connectToGameStream - ' + data.error);
}
} catch (error) {
console.error('connectToGameStream - No valid game data or Unexpected error. ' + Error(error).message);
console.error('connectToGameStream - No valid game data or Unexpected error. ' + error);
}
} else {
//Signal that some empty message arrived
@ -540,7 +540,7 @@ export default function (token: string) {
if (verbose) console.log(board(chess.board));
if (verbose) console.log(chess.turn + "'s turn");
} catch (error) {
console.error(`initializeChessBoard - Error: ${error.message}`);
console.error(`initializeChessBoard - Error: ${error}`);
}
}
@ -593,7 +593,7 @@ export default function (token: string) {
if (verbose) console.log(chess.turn + "'s turn");
}
} catch (error) {
console.error(`updateChessBoard - Error: ${error.message}`);
console.error(`updateChessBoard - Error: ${error}`);
}
}
@ -1137,7 +1137,7 @@ export default function (token: string) {
try {
extendedSanMove = extendedSanMove.replace(keywordsBase[i], ' ' + keywords[keywordsBase[i]].toLowerCase() + ' ');
} catch (error) {
console.error(`raplaceKeywords - Error replacing keyword. ${keywordsBase[i]} . ${Error(error).message}`);
console.error(`raplaceKeywords - Error replacing keyword. ${keywordsBase[i]} . ${error}`);
}
}
return extendedSanMove;
@ -1215,7 +1215,7 @@ export default function (token: string) {
}
}
} catch (err) {
console.warn('compareMoves - ' + Error(err).message);
console.warn('compareMoves - ' + err);
}
return false;
}

View File

@ -14,6 +14,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -36,6 +36,7 @@
},
"devDependencies": {
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"typescript": "^4.4.3"
}
}

View File

@ -18,6 +18,7 @@
"@types/cash": "8.0.0",
"@types/highcharts": "=4.2.57",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"highcharts": "=4.2.5",
"rollup": "^2.56.2",
"typescript": "^4.4.3"

View File

@ -5,6 +5,6 @@
"paths": {
"numeral": ["./@types/numeral"]
},
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
}
}

View File

@ -16,6 +16,7 @@
"@build/rollupProject": "2.0.0",
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -5,7 +5,7 @@
"paths": {
"chessground": ["@types/chessground"]
},
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
},
"extends": "../tsconfig.base.json"
}

View File

@ -17,6 +17,7 @@
"@build/rollupProject": "2.0.0",
"@types/debounce-promise": "^3.1.4",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -9,6 +9,7 @@
"@build/rollupProject": "2.0.0",
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -1,6 +1,6 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
}
}

View File

@ -12,6 +12,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -30,6 +30,7 @@
"devDependencies": {
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"typescript": "^4.4.3"
},
"dependencies": {

View File

@ -4,6 +4,6 @@
"exclude": [],
"compilerOptions": {
"outDir": "./dist",
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
}
}

View File

@ -16,6 +16,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -32,6 +32,7 @@
},
"devDependencies": {
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"typescript": "^4.4.3"
}
}

View File

@ -16,6 +16,7 @@
"@types/cash": "8.0.0",
"@types/chart.js": "^2.9.29",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -1,6 +1,6 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
}
}

View File

@ -15,6 +15,7 @@
"@build/rollupProject": "2.0.0",
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -1,6 +1,6 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
}
}

View File

@ -14,6 +14,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -13,6 +13,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -11,6 +11,7 @@
"@types/debounce-promise": "^3.1.4",
"@types/fnando__sparkline": "^0.3.2",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"@types/yaireo__tagify": "^4.7",
"@types/zxcvbn": "^4.4.0",
"chessground": "^8.1.7",

View File

@ -162,7 +162,7 @@ export default class StrongSocket {
let stack: string;
try {
stack = new Error().stack!.split('\n').join(' / ').replace(/\s+/g, ' ');
} catch (e) {
} catch (e: any) {
stack = `${e.message} ${navigator.userAgent}`;
}
if (!stack.includes('round.nvui')) setTimeout(() => this.send('rep', { n: `soc: ${message} ${stack}` }), 10000);
@ -257,7 +257,7 @@ export default class StrongSocket {
}
};
debug = (msg: string, always = false) => {
debug = (msg: unknown, always = false) => {
if (always || this.options.debug) console.debug(msg);
};
@ -278,7 +278,7 @@ export default class StrongSocket {
}
};
onError = (e: Event) => {
onError = (e: unknown) => {
this.options.debug = true;
this.debug('error: ' + JSON.stringify(e));
this.tryOtherUrl = true;

View File

@ -137,7 +137,7 @@ lichess.load.then(() => {
}, 1000);
// prevent zoom when keyboard shows on iOS
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && 'MSStream' in window) {
const el = document.querySelector('meta[name=viewport]') as HTMLElement;
el.setAttribute('content', el.getAttribute('content') + ',maximum-scale=1.0');
}

View File

@ -15,6 +15,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -15,6 +15,7 @@
"@build/rollupProject": "2.0.0",
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -1,6 +1,6 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
}
}

View File

@ -15,6 +15,7 @@
"@build/rollupProject": "2.0.0",
"@types/cash": "8.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -1,6 +1,6 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"types": ["lichess", "cash"]
"types": ["lichess", "web", "cash"]
}
}

View File

@ -14,6 +14,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -14,6 +14,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -14,6 +14,7 @@
"devDependencies": {
"@build/rollupProject": "2.0.0",
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"rollup": "^2.56.2",
"typescript": "^4.4.3"
},

View File

@ -19,6 +19,7 @@
},
"devDependencies": {
"@types/lichess": "2.0.0",
"@types/web": "=0.0.32",
"typescript": "^4.4.3"
},
"dependencies": {

View File

@ -10,7 +10,7 @@
"moduleResolution": "node",
"target": "ES2017",
"module": "esnext",
"lib": ["DOM", "ES2017", "DOM.iterable"],
"types": ["lichess"]
"lib": ["ES2017"],
"types": ["lichess", "web"]
}
}

View File

@ -287,6 +287,11 @@
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.1.tgz#18845205e86ff0038517aab7a18a62a6b9f71275"
integrity sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA==
"@types/web@=0.0.32":
version "0.0.32"
resolved "https://registry.yarnpkg.com/@types/web/-/web-0.0.32.tgz#f0fd2a26f49719fe999a6a7edc7a37d13b288bec"
integrity sha512-P6r3FT1Ta4ClRVQylpanWN25tYn9fVb68b1eA2thEr5CxjxKJBZMCMXy+di+p3cHVZ0xiqKKLE2cr6iKdgDY2w==
"@types/webrtc@^0.0.27":
version "0.0.27"
resolved "https://registry.yarnpkg.com/@types/webrtc/-/webrtc-0.0.27.tgz#cf9118fa0ac54e530f0ee16c45b8e34df70ef47d"