DEV: Add deprecation notice to discourse-common/utils/decorators (#17052)

This commit is contained in:
Isaac Janzen 2022-06-09 13:07:58 -05:00 committed by GitHub
parent 6ae761604a
commit 9cd165d6b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import isDescriptor from "discourse-common/utils/is-descriptor"; import isDescriptor from "discourse-common/utils/is-descriptor";
import deprecated from "discourse-common/lib/deprecated";
function handleDescriptor(target, property, desc, fn, params = []) { function handleDescriptor(target, property, desc, fn, params = []) {
return { return {
@ -16,6 +17,9 @@ export default function macroAlias(fn) {
if (isDescriptor(params[params.length - 1])) { if (isDescriptor(params[params.length - 1])) {
return handleDescriptor(...params, fn); return handleDescriptor(...params, fn);
} else { } else {
deprecated(
`Importing ${fn.name} from 'discourse-common/utils/decorators' is deprecated. You should instead import it from '@ember/object/computed' directly.`
);
return function (target, property, desc) { return function (target, property, desc) {
return handleDescriptor(target, property, desc, fn, params); return handleDescriptor(target, property, desc, fn, params);
}; };