mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-12 10:26:34 -05:00
Ensure getNewLineFromContext never returns undefined
This commit is contained in:
@@ -21,7 +21,7 @@ namespace ts {
|
||||
|
||||
export function getNewLineFromContext(context: RefactorOrCodeFixContext) {
|
||||
const formatSettings = context.formatContext.options;
|
||||
return formatSettings ? formatSettings.newLineCharacter : context.host.getNewLine();
|
||||
return (formatSettings && formatSettings.newLineCharacter) || getNewLineOrDefaultFromHost(context.host);
|
||||
}
|
||||
|
||||
export function toTextChangesContext(context: RefactorOrCodeFixContext): textChanges.TextChangesContext {
|
||||
|
||||
Reference in New Issue
Block a user