Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to typescript 5.4.2 #2397

Merged
merged 9 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/friendly-chefs-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@latticexyz/cli": patch
"create-mud": patch
---

Bumped `typescript` to `5.4.2`, `eslint` to `8.57.0`, and both `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` to `7.1.1`.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"@types/react-dom": "^18.0.11",
"autoprefixer": "^10.4.16",
"postcss": "^8.4.31",
"typescript": "5.1.6"
"typescript": "5.4.2"
}
}
8 changes: 4 additions & 4 deletions docs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions e2e/packages/client-vanilla/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
network: { components, latestBlock$, worldContract, waitForTransaction },
} = await setup();

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _window = window as any;
_window.worldContract = worldContract;
_window.waitForTransaction = waitForTransaction;
Expand Down
5 changes: 1 addition & 4 deletions e2e/packages/client-vanilla/src/mud/createSystemCalls.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ClientComponents } from "./createClientComponents";
import { SetupNetworkResult } from "./setupNetwork";

export type SystemCalls = ReturnType<typeof createSystemCalls>;

export function createSystemCalls(network: SetupNetworkResult, components: ClientComponents) {
export function createSystemCalls() {
return {
// TODO
};
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/client-vanilla/src/mud/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type SetupResult = Awaited<ReturnType<typeof setup>>;
export async function setup() {
const network = await setupNetwork();
const components = createClientComponents(network);
const systemCalls = createSystemCalls(network, components);
const systemCalls = createSystemCalls();
return {
network,
components,
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1",
"prettier": "3.2.5",
"rimraf": "^3.0.2",
"typescript": "5.1.6",
"typescript": "5.4.2",
"vite": "^4.2.1",
"vitest": "0.34.6"
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/packages/sync-test/data/callPageFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export async function callPageFunction(
args: unknown[],
): Promise<Record<string, unknown> | undefined> {
const context = [functionName, args, serialize.toString(), deserialize.toString()] as const;
const serializedValue = await page.evaluate(async ([functionName, args, serializeString, deserializeString]) => {
const serializedValue = await page.evaluate(async ([functionName, args, serializeString]) => {
const _serialize = deserializeFunction(serializeString);
const _deserialize = deserializeFunction(deserializeString);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const value = await (window as any)[functionName](...args);
const serializedValue = value ? _serialize(value) : undefined;
return serializedValue;
Expand Down
2 changes: 2 additions & 0 deletions e2e/packages/sync-test/data/callWorld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ type WriteArgs<TMethod extends WriteMethodName> = AbiParametersToPrimitiveTypes<
export function callWorld<TMethod extends WriteMethodName>(page: Page, method: TMethod, args?: WriteArgs<TMethod>) {
return page.evaluate(
([_method, _args]) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const worldContract = (window as any).worldContract as WorldContract;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const writeMethod = worldContract.write[_method as any];
return writeMethod(_args)
.then((tx) => window["waitForTransaction"](tx))
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"execa": "^7.1.1",
"happy-dom": "^12.10.3",
"postgres": "3.3.5",
"typescript": "5.1.6",
"typescript": "5.4.2",
"viem": "2.7.12",
"vite": "^4.2.1",
"vitest": "0.34.6",
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/test-data/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions e2e/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions examples/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
},
"devDependencies": {
"@latticexyz/cli": "link:../../packages/cli",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"eslint": "8.29.0",
"@typescript-eslint/eslint-plugin": "7.1.1",
"@typescript-eslint/parser": "7.1.1",
"eslint": "8.57.0",
"mprocs": "^0.6.4",
"typescript": "5.1.6"
"typescript": "5.4.2"
},
"engines": {
"node": "18.x",
Expand Down
8 changes: 4 additions & 4 deletions examples/minimal/packages/client-phaser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"@types/react": "18.2.22",
"@types/react-dom": "18.2.7",
"@types/styled-components": "^5.1.26",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"@typescript-eslint/eslint-plugin": "7.1.1",
"@typescript-eslint/parser": "7.1.1",
"@vitejs/plugin-react": "^3.1.0",
"eslint": "^8.29.0",
"typescript": "5.1.6"
"eslint": "8.57.0",
"typescript": "5.4.2"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import styled from "styled-components";

export const Wrapper = styled.div`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo } from "react";
import { useEffect, useMemo } from "react";
import { createNetworkLayer } from "../../layers/network/createNetworkLayer";
import { usePromiseValue } from "./usePromiseValue";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import useResizeObserver, { ResizeHandler } from "use-resize-observer";
import { throttle } from "lodash";
import { createPhaserLayer } from "../../layers/phaser/createPhaserLayer";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createPublicClient, fallback, webSocket, http, createWalletClient, Hex, parseEther, ClientConfig } from "viem";
import { createFaucetService } from "@latticexyz/services/faucet";
import { createPublicClient, fallback, webSocket, http, createWalletClient, Hex, ClientConfig } from "viem";
import { encodeEntity, syncToRecs } from "@latticexyz/store-sync/recs";
import { getNetworkConfig } from "./getNetworkConfig";
import { world } from "./world";
Expand Down
18 changes: 13 additions & 5 deletions examples/minimal/packages/client-vanilla/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { setup } from "./mud/setup";
import mudConfig from "contracts/mud.config";

declare global {
interface Window {
increment: () => Promise<void>;
willRevert: () => Promise<void>;
sendMessage: () => Promise<void>;
}
}

const {
network,
network: { tables, useStore, worldContract, waitForTransaction },
network: { tables, useStore, worldContract },
systemCalls,
} = await setup();

Expand All @@ -25,19 +33,19 @@ useStore.subscribe((state, prevState) => {

// Just for demonstration purposes: we create a global function that can be
// called to invoke the Increment system contract via the world. (See IncrementSystem.sol.)
(window as any).increment = async () => {
window.increment = async () => {
const result = await systemCalls.increment();
console.log("increment result", result);
};

(window as any).willRevert = async () => {
window.willRevert = async () => {
// set gas limit so we skip estimation and can test tx revert
const tx = await worldContract.write.willRevert({ gas: 100000n });

console.log("willRevert tx", tx);
};

(window as any).sendMessage = async () => {
window.sendMessage = async () => {
const input = document.getElementById("chat-input") as HTMLInputElement;
const msg = input.value;
if (!msg || msg.length === 0) return;
Expand All @@ -51,7 +59,7 @@ useStore.subscribe((state, prevState) => {

document.getElementById("chat-form")?.addEventListener("submit", (e) => {
e.preventDefault();
(window as any).sendMessage();
window.sendMessage();
});

// https://vitejs.dev/guide/env-and-mode.html
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal/packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"solhint-config-mud": "file:../../../../packages/solhint-config-mud",
"solhint-plugin-mud": "file:../../../../packages/solhint-plugin-mud",
"ts-node": "^10.9.1",
"typescript": "5.1.6"
"typescript": "5.4.2"
}
}
2 changes: 1 addition & 1 deletion examples/minimal/packages/plugin-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"@types/node": "^18.15.11",
"rimraf": "^3.0.2",
"tsup": "^6.7.0",
"typescript": "5.1.6"
"typescript": "5.4.2"
}
}
Loading
Loading