Skip to content

Commit

Permalink
fix(rosetta): "Rosetta configured for live conversion to undefined" (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
RomainMuller authored and skinny85 committed Dec 13, 2019
1 parent 138320c commit 10e9d38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/jsii-rosetta/lib/rosetta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 10e9d38

Please sign in to comment.