Skip to content

Commit

Permalink
avoid try-catch as suggested in PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz committed Feb 6, 2024
1 parent 99e2bf3 commit 14300de
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/wrangler/src/type-generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ export async function generateTypes(
configToDTS: Partial<Config>,
config: Config
) {
let entrypointFormat: CfScriptFormat = "modules";
try {
const entry = await getEntry({}, config, "types");
entrypointFormat = entry.format;
} catch {}
const configContainsEntryPoint =
config.main !== undefined || !!config.site?.["entry-point"];

const entrypointFormat: CfScriptFormat = configContainsEntryPoint
? (await getEntry({}, config, "types")).format
: "modules";

Check warning on line 20 in packages/wrangler/src/type-generation.ts

View check run for this annotation

Codecov / codecov/patch

packages/wrangler/src/type-generation.ts#L20

Added line #L20 was not covered by tests

const envTypeStructure: string[] = [];

if (configToDTS.kv_namespaces) {
Expand Down

0 comments on commit 14300de

Please sign in to comment.