Skip to content

Commit

Permalink
refactor: use optional chaining in template params validation (asynca…
Browse files Browse the repository at this point in the history
…pi#1299)

Co-authored-by: Lukasz Gornicki <[email protected]>
  • Loading branch information
thebedigupta and derberg authored Oct 14, 2024
1 parent 0e3478b commit 254b072
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/generator/lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class Generator {
Object.defineProperty(this.templateParams, key, {
enumerable: true,
get() {
if (!self.templateConfig.parameters || !self.templateConfig.parameters[key]) {
if (!self.templateConfig.parameters?.[key]) {
throw new Error(`Template parameter "${key}" has not been defined in the package.json file under generator property. Please make sure it's listed there before you use it in your template.`);
}
return templateParams[key];
Expand Down

0 comments on commit 254b072

Please sign in to comment.