Deprecate camelCase config options (#11261)

pull/28788/head^2
Michael Telatynski 2023-07-14 11:50:52 +01:00 committed by GitHub
parent 77c3a89cbc
commit 3a784c71e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -25,7 +25,15 @@ export class SnakedObject<T = Record<string, any>> {
const val = this.obj[key];
if (val !== undefined) return val;
return this.obj[<K>(altCaseName ?? snakeToCamel(key))];
const fallbackKey = altCaseName ?? snakeToCamel(key);
const fallback = this.obj[<K>fallbackKey];
if (!!fallback) {
console.warn(`Using deprecated camelCase config ${fallbackKey}`);
console.warn(
"See https://github.com/vector-im/element-web/blob/develop/docs/config.md#-deprecation-notice",
);
}
return fallback;
}
// Make JSON.stringify() pretend that everything is fine