fix(localize): ensure that `formatOptions` is optional (#38787)

Some lower level APIs are used by CLI, and requiring
the `formatOpions` argument at that level is a
breaking change. This commit makes it optional
at every level to avoid the breaking change.

PR Close #38787
This commit is contained in:
Pete Bacon Darwin 2020-09-10 09:17:42 +01:00 committed by Andrew Kushnir
parent d1415162cb
commit ce1efc1af2
3 changed files with 3 additions and 3 deletions

View File

@ -208,7 +208,7 @@ export function extractTranslations({
export function getSerializer(
format: string, sourceLocale: string, rootPath: AbsoluteFsPath, useLegacyIds: boolean,
formatOptions: FormatOptions): TranslationSerializer {
formatOptions: FormatOptions = {}): TranslationSerializer {
switch (format) {
case 'xlf':
case 'xlif':

View File

@ -27,7 +27,7 @@ const LEGACY_XLIFF_MESSAGE_LENGTH = 40;
export class Xliff1TranslationSerializer implements TranslationSerializer {
constructor(
private sourceLocale: string, private basePath: AbsoluteFsPath, private useLegacyIds: boolean,
private formatOptions: FormatOptions) {
private formatOptions: FormatOptions = {}) {
validateOptions('Xliff1TranslationSerializer', [['xml:space', ['preserve']]], formatOptions);
}

View File

@ -27,7 +27,7 @@ export class Xliff2TranslationSerializer implements TranslationSerializer {
private currentPlaceholderId = 0;
constructor(
private sourceLocale: string, private basePath: AbsoluteFsPath, private useLegacyIds: boolean,
private formatOptions: FormatOptions) {
private formatOptions: FormatOptions = {}) {
validateOptions('Xliff1TranslationSerializer', [['xml:space', ['preserve']]], formatOptions);
}