diff --git a/.changeset/chilly-gorillas-teach.md b/.changeset/chilly-gorillas-teach.md new file mode 100644 index 000000000..699ad36a8 --- /dev/null +++ b/.changeset/chilly-gorillas-teach.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": patch +--- + +fix: use optional chaining in bin catch block diff --git a/packages/openapi-ts/bin/index.cjs b/packages/openapi-ts/bin/index.cjs index 66883eecf..f654ad3bc 100755 --- a/packages/openapi-ts/bin/index.cjs +++ b/packages/openapi-ts/bin/index.cjs @@ -81,7 +81,7 @@ async function start() { await createClient(userConfig); process.exit(0); } catch (error) { - if (!userConfig.dryRun) { + if (!userConfig?.dryRun) { const logName = `openapi-ts-error-${Date.now()}.log`; const logPath = resolve(process.cwd(), logName); writeFileSync(logPath, `${error.message}\n${error.stack}`);