diff --git a/types/diff/diff-tests.ts b/types/diff/diff-tests.ts index 55f89fb938b6f49..bdfac4e489f338c 100644 --- a/types/diff/diff-tests.ts +++ b/types/diff/diff-tests.ts @@ -21,6 +21,7 @@ Diff.diffLines( 'line\nold value\nline', 'line\nnew value\nline', { + ignoreNewlineAtEof: true, maxEditLength: 1, oneChangePerToken: true, }, diff --git a/types/diff/index.d.ts b/types/diff/index.d.ts index cc639d000dd01b6..2ac6744908d00c4 100644 --- a/types/diff/index.d.ts +++ b/types/diff/index.d.ts @@ -35,6 +35,11 @@ export interface WordsOptions extends BaseOptions { } export interface LinesOptions extends BaseOptions { + /** + * `true` to ignore a missing newline character at the end of the last line when comparing it to other lines. (By default, the line `'b\n'` in text `'a\nb\nc'` is not considered equal to the line `'b'` in text `'a\nb'`; this option makes them be considered equal.) Ignored if `ignoreWhitespace` or `newlineIsToken` are also true. + */ + ignoreNewlineAtEof?: boolean | undefined; + /** * `true` to ignore leading and trailing whitespace. This is the same as `diffTrimmedLines()`. */