From 1335761e22d3200f6be095ebdc2f6f7498243202 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Wed, 21 Aug 2024 18:51:18 +0100 Subject: [PATCH] fix type issue --- packages/world/ts/node/findContractArtifacts.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/world/ts/node/findContractArtifacts.ts b/packages/world/ts/node/findContractArtifacts.ts index 82de40ae13..a7ed010470 100644 --- a/packages/world/ts/node/findContractArtifacts.ts +++ b/packages/world/ts/node/findContractArtifacts.ts @@ -15,6 +15,13 @@ export type Input = { export type Output = readonly ContractArtifact[]; const parseArtifact = type("parse.json").to(types.Artifact); +type Artifact = typeof types.Artifact.infer; + +function hasMetadata( + artifact: Artifact, +): artifact is Artifact & { [k in "metadata"]-?: Exclude } { + return artifact.metadata !== undefined; +} export async function findContractArtifacts({ forgeOutDir }: Input): Promise { const files = (await glob("**/*.sol/*.json", { ignore: "**/*.abi.json", cwd: forgeOutDir })).sort(); @@ -35,8 +42,9 @@ export async function findContractArtifacts({ forgeOutDir }: Input): Promise { + artifact; const sourcePath = Object.keys(artifact.metadata.settings.compilationTarget)[0]; const name = artifact.metadata.settings.compilationTarget[sourcePath]; const deployedBytecodeSize = size(artifact.deployedBytecode.object);