mirror of https://github.com/vector-im/riot-web
Update dependency typescript to v5 (#25050)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>pull/24604/head
parent
6cfa1eea7b
commit
1ebe574ab1
|
@ -173,7 +173,7 @@
|
||||||
"stylelint-scss": "^4.2.0",
|
"stylelint-scss": "^4.2.0",
|
||||||
"terser-webpack-plugin": "^4.0.0",
|
"terser-webpack-plugin": "^4.0.0",
|
||||||
"ts-prune": "^0.10.3",
|
"ts-prune": "^0.10.3",
|
||||||
"typescript": "4.9.5",
|
"typescript": "5.0.3",
|
||||||
"webpack": "^4.46.0",
|
"webpack": "^4.46.0",
|
||||||
"webpack-cli": "^3.3.12",
|
"webpack-cli": "^3.3.12",
|
||||||
"webpack-dev-server": "^3.11.2",
|
"webpack-dev-server": "^3.11.2",
|
||||||
|
|
|
@ -152,7 +152,7 @@ export default class Favicon {
|
||||||
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
||||||
this.context.drawImage(this.baseImage, 0, 0, this.canvas.width, this.canvas.height);
|
this.context.drawImage(this.baseImage, 0, 0, this.canvas.width, this.canvas.height);
|
||||||
this.context.beginPath();
|
this.context.beginPath();
|
||||||
const fontSize = Math.floor(opt.h * (opt.n > 99 ? 0.85 : 1)) + "px";
|
const fontSize = Math.floor(opt.h * (typeof opt.n === "number" && opt.n > 99 ? 0.85 : 1)) + "px";
|
||||||
this.context.font = `${params.fontWeight} ${fontSize} ${params.fontFamily}`;
|
this.context.font = `${params.fontWeight} ${fontSize} ${params.fontFamily}`;
|
||||||
this.context.textAlign = "center";
|
this.context.textAlign = "center";
|
||||||
|
|
||||||
|
|
|
@ -42,13 +42,13 @@ describe("loading:", function () {
|
||||||
let httpBackend;
|
let httpBackend;
|
||||||
|
|
||||||
// an Object simulating the window.location
|
// an Object simulating the window.location
|
||||||
let windowLocation;
|
let windowLocation: Location | undefined;
|
||||||
|
|
||||||
// the mounted MatrixChat
|
// the mounted MatrixChat
|
||||||
let matrixChat: RenderResult;
|
let matrixChat: RenderResult<any, any, any> | undefined;
|
||||||
|
|
||||||
// a promise which resolves when the MatrixChat calls onTokenLoginCompleted
|
// a promise which resolves when the MatrixChat calls onTokenLoginCompleted
|
||||||
let tokenLoginCompletePromise;
|
let tokenLoginCompletePromise: Promise<void> | undefined;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
httpBackend = new MockHttpBackend();
|
httpBackend = new MockHttpBackend();
|
||||||
|
@ -59,8 +59,8 @@ describe("loading:", function () {
|
||||||
// debugging (but slow things down)
|
// debugging (but slow things down)
|
||||||
// document.body.appendChild(parentDiv);
|
// document.body.appendChild(parentDiv);
|
||||||
|
|
||||||
windowLocation = null;
|
windowLocation = undefined;
|
||||||
matrixChat = null;
|
matrixChat = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
@ -91,12 +91,12 @@ describe("loading:", function () {
|
||||||
toString: function (): string {
|
toString: function (): string {
|
||||||
return this.search + this.hash;
|
return this.search + this.hash;
|
||||||
},
|
},
|
||||||
};
|
} as Location;
|
||||||
|
|
||||||
function onNewScreen(screen): void {
|
function onNewScreen(screen): void {
|
||||||
console.log(Date.now() + " newscreen " + screen);
|
console.log(Date.now() + " newscreen " + screen);
|
||||||
const hash = "#/" + screen;
|
const hash = "#/" + screen;
|
||||||
windowLocation.hash = hash;
|
windowLocation!.hash = hash;
|
||||||
console.log(Date.now() + " browser URI now " + windowLocation);
|
console.log(Date.now() + " browser URI now " + windowLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ describe("loading:", function () {
|
||||||
return awaitWelcomeComponent(matrixChat);
|
return awaitWelcomeComponent(matrixChat);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return waitFor(() => expect(windowLocation.hash).toEqual("#/welcome"));
|
return waitFor(() => expect(windowLocation?.hash).toEqual("#/welcome"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ describe("loading:", function () {
|
||||||
return moveFromWelcomeToLogin(matrixChat);
|
return moveFromWelcomeToLogin(matrixChat);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return completeLogin(matrixChat);
|
return completeLogin(matrixChat!);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// once the sync completes, we should have a room view
|
// once the sync completes, we should have a room view
|
||||||
|
@ -256,7 +256,7 @@ describe("loading:", function () {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
httpBackend.verifyNoOutstandingExpectation();
|
httpBackend.verifyNoOutstandingExpectation();
|
||||||
expect(windowLocation.hash).toEqual("#/room/!room:id");
|
expect(windowLocation?.hash).toEqual("#/room/!room:id");
|
||||||
|
|
||||||
// and the localstorage should have been updated
|
// and the localstorage should have been updated
|
||||||
expect(localStorage.getItem("mx_user_id")).toEqual("@user:id");
|
expect(localStorage.getItem("mx_user_id")).toEqual("@user:id");
|
||||||
|
@ -293,11 +293,11 @@ describe("loading:", function () {
|
||||||
|
|
||||||
throw new Error(`Unexpected HTTP request to ${req}`);
|
throw new Error(`Unexpected HTTP request to ${req}`);
|
||||||
}
|
}
|
||||||
return completeLogin(matrixChat);
|
return completeLogin(matrixChat!);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(matrixChat.container.querySelector(".mx_HomePage")).toBeTruthy();
|
expect(matrixChat?.container.querySelector(".mx_HomePage")).toBeTruthy();
|
||||||
expect(windowLocation.hash).toEqual("#/home");
|
expect(windowLocation?.hash).toEqual("#/home");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -318,7 +318,7 @@ describe("loading:", function () {
|
||||||
it("shows the last known room by default", function () {
|
it("shows the last known room by default", function () {
|
||||||
loadApp();
|
loadApp();
|
||||||
|
|
||||||
return awaitLoggedIn(matrixChat)
|
return awaitLoggedIn(matrixChat!)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// we are logged in - let the sync complete
|
// we are logged in - let the sync complete
|
||||||
return expectAndAwaitSync();
|
return expectAndAwaitSync();
|
||||||
|
@ -329,7 +329,7 @@ describe("loading:", function () {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
httpBackend.verifyNoOutstandingExpectation();
|
httpBackend.verifyNoOutstandingExpectation();
|
||||||
expect(windowLocation.hash).toEqual("#/room/!last_room:id");
|
expect(windowLocation?.hash).toEqual("#/room/!last_room:id");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ describe("loading:", function () {
|
||||||
|
|
||||||
loadApp();
|
loadApp();
|
||||||
|
|
||||||
return awaitLoggedIn(matrixChat)
|
return awaitLoggedIn(matrixChat!)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// we are logged in - let the sync complete
|
// we are logged in - let the sync complete
|
||||||
return expectAndAwaitSync();
|
return expectAndAwaitSync();
|
||||||
|
@ -346,8 +346,8 @@ describe("loading:", function () {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// once the sync completes, we should have a home page
|
// once the sync completes, we should have a home page
|
||||||
httpBackend.verifyNoOutstandingExpectation();
|
httpBackend.verifyNoOutstandingExpectation();
|
||||||
expect(matrixChat.container.querySelector(".mx_HomePage")).toBeTruthy();
|
expect(matrixChat?.container.querySelector(".mx_HomePage")).toBeTruthy();
|
||||||
expect(windowLocation.hash).toEqual("#/home");
|
expect(windowLocation?.hash).toEqual("#/home");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ describe("loading:", function () {
|
||||||
uriFragment: "#/room/!room:id",
|
uriFragment: "#/room/!room:id",
|
||||||
});
|
});
|
||||||
|
|
||||||
return awaitLoggedIn(matrixChat)
|
return awaitLoggedIn(matrixChat!)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// we are logged in - let the sync complete
|
// we are logged in - let the sync complete
|
||||||
return expectAndAwaitSync();
|
return expectAndAwaitSync();
|
||||||
|
@ -367,7 +367,7 @@ describe("loading:", function () {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
httpBackend.verifyNoOutstandingExpectation();
|
httpBackend.verifyNoOutstandingExpectation();
|
||||||
expect(windowLocation.hash).toEqual("#/room/!room:id");
|
expect(windowLocation?.hash).toEqual("#/room/!room:id");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ describe("loading:", function () {
|
||||||
return httpBackend.flush();
|
return httpBackend.flush();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return awaitLoggedIn(matrixChat);
|
return awaitLoggedIn(matrixChat!);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// we are logged in - let the sync complete
|
// we are logged in - let the sync complete
|
||||||
|
@ -422,8 +422,8 @@ describe("loading:", function () {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// once the sync completes, we should have a welcome page
|
// once the sync completes, we should have a welcome page
|
||||||
httpBackend.verifyNoOutstandingExpectation();
|
httpBackend.verifyNoOutstandingExpectation();
|
||||||
expect(matrixChat.container.querySelector(".mx_Welcome")).toBeTruthy();
|
expect(matrixChat?.container.querySelector(".mx_Welcome")).toBeTruthy();
|
||||||
expect(windowLocation.hash).toEqual("#/welcome");
|
expect(windowLocation?.hash).toEqual("#/welcome");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ describe("loading:", function () {
|
||||||
return httpBackend.flush();
|
return httpBackend.flush();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return awaitLoggedIn(matrixChat);
|
return awaitLoggedIn(matrixChat!);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return expectAndAwaitSync({ isGuest: true });
|
return expectAndAwaitSync({ isGuest: true });
|
||||||
|
@ -460,8 +460,8 @@ describe("loading:", function () {
|
||||||
|
|
||||||
// once the sync completes, we should have a welcome page
|
// once the sync completes, we should have a welcome page
|
||||||
httpBackend.verifyNoOutstandingExpectation();
|
httpBackend.verifyNoOutstandingExpectation();
|
||||||
expect(matrixChat.container.querySelector(".mx_Welcome")).toBeTruthy();
|
expect(matrixChat?.container.querySelector(".mx_Welcome")).toBeTruthy();
|
||||||
expect(windowLocation.hash).toEqual("#/welcome");
|
expect(windowLocation?.hash).toEqual("#/welcome");
|
||||||
expect(MatrixClientPeg.get().baseUrl).toEqual(DEFAULT_HS_URL);
|
expect(MatrixClientPeg.get().baseUrl).toEqual(DEFAULT_HS_URL);
|
||||||
expect(MatrixClientPeg.get().idBaseUrl).toEqual(DEFAULT_IS_URL);
|
expect(MatrixClientPeg.get().idBaseUrl).toEqual(DEFAULT_IS_URL);
|
||||||
});
|
});
|
||||||
|
@ -490,7 +490,7 @@ describe("loading:", function () {
|
||||||
return httpBackend.flush();
|
return httpBackend.flush();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return awaitLoggedIn(matrixChat);
|
return awaitLoggedIn(matrixChat!);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return expectAndAwaitSync({ isGuest: true });
|
return expectAndAwaitSync({ isGuest: true });
|
||||||
|
@ -501,7 +501,7 @@ describe("loading:", function () {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
httpBackend.verifyNoOutstandingExpectation();
|
httpBackend.verifyNoOutstandingExpectation();
|
||||||
expect(windowLocation.hash).toEqual("#/room/!room:id");
|
expect(windowLocation?.hash).toEqual("#/room/!room:id");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ describe("loading:", function () {
|
||||||
return httpBackend
|
return httpBackend
|
||||||
.flush()
|
.flush()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return awaitLoggedIn(matrixChat);
|
return awaitLoggedIn(matrixChat!);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// we got a sync spinner - let the sync complete
|
// we got a sync spinner - let the sync complete
|
||||||
|
@ -531,7 +531,7 @@ describe("loading:", function () {
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
// once the sync completes, we should have a home page
|
// once the sync completes, we should have a home page
|
||||||
await waitFor(() => matrixChat.container.querySelector(".mx_HomePage"));
|
await waitFor(() => matrixChat?.container.querySelector(".mx_HomePage"));
|
||||||
|
|
||||||
// we simulate a click on the 'login' button by firing off
|
// we simulate a click on the 'login' button by firing off
|
||||||
// the relevant dispatch.
|
// the relevant dispatch.
|
||||||
|
@ -553,7 +553,7 @@ describe("loading:", function () {
|
||||||
await screen.findByRole("main");
|
await screen.findByRole("main");
|
||||||
screen.getAllByText("Sign in");
|
screen.getAllByText("Sign in");
|
||||||
|
|
||||||
expect(windowLocation.hash).toEqual("#/login");
|
expect(windowLocation?.hash).toEqual("#/login");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -607,7 +607,7 @@ describe("loading:", function () {
|
||||||
|
|
||||||
// check that we have a Login component, send a 'user:pass' login,
|
// check that we have a Login component, send a 'user:pass' login,
|
||||||
// and await the HTTP requests.
|
// and await the HTTP requests.
|
||||||
async function completeLogin(matrixChat: RenderResult): Promise<void> {
|
async function completeLogin(matrixChat: RenderResult<any, any, any>): Promise<void> {
|
||||||
// When we switch to the login component, it'll hit the login endpoint
|
// When we switch to the login component, it'll hit the login endpoint
|
||||||
// for proof of life and to get flows. We'll only give it one option.
|
// for proof of life and to get flows. We'll only give it one option.
|
||||||
httpBackend.when("GET", "/login").respond(200, { flows: [{ type: "m.login.password" }] });
|
httpBackend.when("GET", "/login").respond(200, { flows: [{ type: "m.login.password" }] });
|
||||||
|
@ -630,8 +630,8 @@ describe("loading:", function () {
|
||||||
device_id: "DEVICE_ID",
|
device_id: "DEVICE_ID",
|
||||||
access_token: "access_token",
|
access_token: "access_token",
|
||||||
});
|
});
|
||||||
fireEvent.change(matrixChat.container.querySelector("#mx_LoginForm_username"), { target: { value: "user" } });
|
fireEvent.change(matrixChat.container.querySelector("#mx_LoginForm_username")!, { target: { value: "user" } });
|
||||||
fireEvent.change(matrixChat.container.querySelector("#mx_LoginForm_password"), { target: { value: "pass" } });
|
fireEvent.change(matrixChat.container.querySelector("#mx_LoginForm_password")!, { target: { value: "pass" } });
|
||||||
fireEvent.click(screen.getByText("Sign in", { selector: ".mx_Login_submit" }));
|
fireEvent.click(screen.getByText("Sign in", { selector: ".mx_Login_submit" }));
|
||||||
|
|
||||||
return httpBackend
|
return httpBackend
|
||||||
|
@ -656,7 +656,7 @@ async function assertAtLoadingSpinner(): Promise<void> {
|
||||||
await screen.findByRole("progressbar");
|
await screen.findByRole("progressbar");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function awaitLoggedIn(matrixChat: RenderResult): Promise<void> {
|
async function awaitLoggedIn(matrixChat: RenderResult<any, any, any>): Promise<void> {
|
||||||
if (matrixChat.container.querySelector(".mx_MatrixChat_wrapper")) return; // already logged in
|
if (matrixChat.container.querySelector(".mx_MatrixChat_wrapper")) return; // already logged in
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
@ -673,19 +673,19 @@ async function awaitLoggedIn(matrixChat: RenderResult): Promise<void> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function awaitRoomView(matrixChat: RenderResult): Promise<void> {
|
async function awaitRoomView(matrixChat?: RenderResult<any, any, any>): Promise<void> {
|
||||||
await waitFor(() => matrixChat.container.querySelector(".mx_RoomView"));
|
await waitFor(() => matrixChat?.container.querySelector(".mx_RoomView"));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function awaitLoginComponent(matrixChat: RenderResult): Promise<void> {
|
async function awaitLoginComponent(matrixChat?: RenderResult<any, any, any>): Promise<void> {
|
||||||
await waitFor(() => matrixChat.container.querySelector(".mx_AuthPage"));
|
await waitFor(() => matrixChat?.container.querySelector(".mx_AuthPage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function awaitWelcomeComponent(matrixChat: RenderResult): Promise<void> {
|
async function awaitWelcomeComponent(matrixChat?: RenderResult<any, any, any>): Promise<void> {
|
||||||
await waitFor(() => matrixChat.container.querySelector(".mx_Welcome"));
|
await waitFor(() => matrixChat?.container.querySelector(".mx_Welcome"));
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveFromWelcomeToLogin(matrixChat: RenderResult): Promise<void> {
|
function moveFromWelcomeToLogin(matrixChat?: RenderResult<any, any, any>): Promise<void> {
|
||||||
dis.dispatch({ action: "start_login" });
|
dis.dispatch({ action: "start_login" });
|
||||||
return awaitLoginComponent(matrixChat);
|
return awaitLoginComponent(matrixChat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12154,10 +12154,10 @@ typedarray@^0.0.6:
|
||||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||||
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
|
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
|
||||||
|
|
||||||
typescript@4.9.5:
|
typescript@5.0.3:
|
||||||
version "4.9.5"
|
version "5.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.3.tgz#fe976f0c826a88d0a382007681cbb2da44afdedf"
|
||||||
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
|
integrity sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==
|
||||||
|
|
||||||
typeson-registry@^1.0.0-alpha.20:
|
typeson-registry@^1.0.0-alpha.20:
|
||||||
version "1.0.0-alpha.39"
|
version "1.0.0-alpha.39"
|
||||||
|
|
Loading…
Reference in New Issue