Allow to delete freeform keys again, partial fix of #2008

This commit is contained in:
Pieter Vander Vennet 2024-07-09 13:06:56 +02:00
parent 4df2d34f02
commit d8da61ec07
5 changed files with 56 additions and 17 deletions

View file

@ -382,13 +382,15 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
/**
* Creates a new array with all elements from 'arr' in such a way that every element will be kept only once
* Elements are returned in the same order as they appear in the lists
* @param arr
* @constructor
* Elements are returned in the same order as they appear in the lists.
* Null/Undefined is returned as is. If an emtpy array is given, a new empty array will be returned
*/
public static Dedup(arr: NonNullable<string[]>): NonNullable<string[]>
public static Dedup(arr: undefined):undefined
public static Dedup(arr: string[] | undefined): string[] | undefined
public static Dedup(arr: string[]): string[] {
if (arr === undefined) {
return undefined
if (arr === undefined || arr === null) {
return arr
}
const newArr = []
for (const string of arr) {