Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tracked and other improvements #1035

Merged
merged 12 commits into from
Oct 23, 2019
14 changes: 13 additions & 1 deletion ember_debug/object-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { isComputed, isDescriptor, getDescriptorFor } from 'ember-debug/utils/ty

const Ember = window.Ember;
const {
Object: EmberObject, inspect: emberInspect, meta: emberMeta, typeOf,
Object: EmberObject, inspect: emberInspect, meta: emberMeta, typeOf: emberTypeOf,
computed, get, set, guidFor, isNone,
Mixin, cacheFor, VERSION
} = Ember;
Expand All @@ -22,6 +22,18 @@ try {

const keys = Object.keys || Ember.keys;

/**
* workaround to support detection of `[object AsyncFunction]` as a function
* @param value
* @returns {string}
*/
function typeOf(value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patricklx what did we need this change for?

Copy link
Collaborator Author

@patricklx patricklx Oct 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ember.typeOf will not detect async function as function and will tell its an object instead. (Check discord chat)
I could also make a pr against emberjs for that...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does seem like a bug in Ember, but it's probably fine for now to fix it here and try to upstream the fix later.

if (typeof value === 'function') {
return 'function';
}
return emberTypeOf(value);
}

/**
* Determine the type and get the value of the passed property
* @param {*} object The parent object we will look for `key` on
Expand Down