From 90923e2050172c922c8b6be57ab69786c2a77922 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 14 May 2020 14:05:32 -0700 Subject: [PATCH] Make FormattingHost required again --- src/services/formatting/formatting.ts | 2 +- src/services/utilities.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index d9553ea3465f9..951ad5e5bba87 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -3,7 +3,7 @@ namespace ts.formatting { export interface FormatContext { readonly options: FormatCodeSettings; readonly getRules: RulesMap; - readonly host?: FormattingHost; + readonly host: FormattingHost; } export interface TextRangeWithKind extends TextRange { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 2c551fe9d7c07..b1799167c437b 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -2085,9 +2085,9 @@ namespace ts { /** * The default is CRLF. */ - export function getNewLineOrDefaultFromHost(host: FormattingHost | undefined, formatSettings?: FormatCodeSettings) { + export function getNewLineOrDefaultFromHost(host: FormattingHost, formatSettings?: FormatCodeSettings) { return formatSettings?.newLineCharacter || - host?.getNewLine?.() || + host.getNewLine?.() || carriageReturnLineFeed; }