Update Typescript to 4.5 (#7344)

This commit is contained in:
Michael Telatynski 2021-12-13 11:22:53 +00:00 committed by GitHub
parent fcc4939075
commit c96b9413e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 24 deletions

View file

@ -185,7 +185,7 @@
"stylelint": "^13.9.0", "stylelint": "^13.9.0",
"stylelint-config-standard": "^20.0.0", "stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.18.0", "stylelint-scss": "^3.18.0",
"typescript": "4.3.5", "typescript": "4.5.3",
"walk": "^2.3.14" "walk": "^2.3.14"
}, },
"resolutions": { "resolutions": {

View file

@ -66,6 +66,16 @@ declare global {
// Needed for Safari, unknown to TypeScript // Needed for Safari, unknown to TypeScript
webkitAudioContext: typeof AudioContext; webkitAudioContext: typeof AudioContext;
// https://docs.microsoft.com/en-us/previous-versions/hh772328(v=vs.85)
// we only ever check for its existence, so we can ignore its actual type
MSStream?: unknown;
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1029#issuecomment-869224737
// https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas
OffscreenCanvas?: {
new(width: number, height: number): OffscreenCanvas;
};
mxContentMessages: ContentMessages; mxContentMessages: ContentMessages;
mxToastStore: ToastStore; mxToastStore: ToastStore;
mxDeviceListener: DeviceListener; mxDeviceListener: DeviceListener;
@ -123,11 +133,6 @@ declare global {
} }
interface Document { interface Document {
// https://developer.mozilla.org/en-US/docs/Web/API/Document/hasStorageAccess
hasStorageAccess?: () => Promise<boolean>;
// https://developer.mozilla.org/en-US/docs/Web/API/Document/requestStorageAccess
requestStorageAccess?: () => Promise<undefined>;
// Safari & IE11 only have this prefixed: we used prefixed versions // Safari & IE11 only have this prefixed: we used prefixed versions
// previously so let's continue to support them for now // previously so let's continue to support them for now
webkitExitFullscreen(): Promise<void>; webkitExitFullscreen(): Promise<void>;
@ -138,27 +143,26 @@ declare global {
interface Navigator { interface Navigator {
userLanguage?: string; userLanguage?: string;
// https://github.com/Microsoft/TypeScript/issues/19473
// https://developer.mozilla.org/en-US/docs/Web/API/MediaSession
mediaSession: any;
} }
interface StorageEstimate { interface StorageEstimate {
usageDetails?: { [key: string]: number }; usageDetails?: { [key: string]: number };
} }
interface HTMLAudioElement { // https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas
type?: string; interface OffscreenCanvas {
// sinkId & setSinkId are experimental and typescript doesn't know about them height: number;
sinkId: string; width: number;
setSinkId(outputId: string); getContext: HTMLCanvasElement["getContext"];
convertToBlob(opts?: {
type?: string;
quality?: number;
}): Promise<Blob>;
transferToImageBitmap(): ImageBitmap;
} }
interface HTMLVideoElement { interface HTMLAudioElement {
type?: string; type?: string;
// sinkId & setSinkId are experimental and typescript doesn't know about them
sinkId: string;
setSinkId(outputId: string);
} }
interface HTMLStyleElement { interface HTMLStyleElement {
@ -210,6 +214,11 @@ declare global {
new (options?: AudioWorkletNodeOptions): AudioWorkletProcessor; new (options?: AudioWorkletNodeOptions): AudioWorkletProcessor;
}; };
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1029#issuecomment-881509595
interface AudioParamDescriptor {
readonly port: MessagePort;
}
// https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278 // https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278
function registerProcessor( function registerProcessor(
name: string, name: string,

View file

@ -131,8 +131,8 @@ async function createThumbnail(
canvas = new window.OffscreenCanvas(targetWidth, targetHeight); canvas = new window.OffscreenCanvas(targetWidth, targetHeight);
} else { } else {
canvas = document.createElement("canvas"); canvas = document.createElement("canvas");
canvas.width = targetWidth; (canvas as HTMLCanvasElement).width = targetWidth;
canvas.height = targetHeight; (canvas as HTMLCanvasElement).height = targetHeight;
} }
const context = canvas.getContext("2d"); const context = canvas.getContext("2d");

View file

@ -8440,10 +8440,10 @@ typedarray-to-buffer@^3.1.5:
dependencies: dependencies:
is-typedarray "^1.0.0" is-typedarray "^1.0.0"
typescript@4.3.5: typescript@4.5.3:
version "4.3.5" version "4.5.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.3.tgz#afaa858e68c7103317d89eb90c5d8906268d353c"
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== integrity sha512-eVYaEHALSt+s9LbvgEv4Ef+Tdq7hBiIZgii12xXJnukryt3pMgJf6aKhoCZ3FWQsu6sydEnkg11fYXLzhLBjeQ==
ua-parser-js@^0.7.30: ua-parser-js@^0.7.30:
version "0.7.31" version "0.7.31"