From 10e9d3863e36bc86afd57f399cb64c02a8f1df4d Mon Sep 17 00:00:00 2001 From: Romain Marcadier-Muller Date: Fri, 13 Dec 2019 14:48:38 -0800 Subject: [PATCH] fix(rosetta): "Rosetta configured for live conversion to undefined" (#1120) An incorrect update to optional chaining changed the criteria for the target overlap test in Rosetta live conversions and triggered the error in the regular case instead of only in cases where restricts have to be enforced. Reverted to the previous syntax with achieves the correct result. --- packages/jsii-rosetta/lib/rosetta.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/jsii-rosetta/lib/rosetta.ts b/packages/jsii-rosetta/lib/rosetta.ts index eef8b337cb..3370962f43 100644 --- a/packages/jsii-rosetta/lib/rosetta.ts +++ b/packages/jsii-rosetta/lib/rosetta.ts @@ -109,8 +109,8 @@ export class Rosetta { } if (!this.options.liveConversion) { return undefined; } - if (!this.options.targetLanguages?.includes(targetLang)) { - throw new Error(`Rosetta configured for live conversion to ${this.options.targetLanguages}, but requested ${targetLang}`); + if (this.options.targetLanguages && !this.options.targetLanguages.includes(targetLang)) { + throw new Error(`Rosetta configured for live conversion to ${this.options.targetLanguages.join(', ')}, but requested ${targetLang}`); } // See if we're going to live-convert it with full source information