diff --git a/ember-async-data/src/helpers/load.ts b/ember-async-data/src/helpers/load.ts index db85dfdf..7ee77fed 100644 --- a/ember-async-data/src/helpers/load.ts +++ b/ember-async-data/src/helpers/load.ts @@ -1,4 +1,3 @@ -import { helper } from '@ember/component/helper'; import TrackedAsyncData from '../tracked-async-data'; /** @@ -53,26 +52,11 @@ import TrackedAsyncData from '../tracked-async-data'; @param data The (async) data we want to operate on: a value or a `Promise` of a value. - @param context An optional, but highly recommended, context object to use for - managing the destruction of the resulting `TrackedAsyncData`, which can be - any object which participates in Ember's normal destruction lifecycle - (components, helpers, modifiers, etc.). If you do not supply this parameter, - and you have a test failure which causes async code to not get cleaned up - you may see all following tests fail. @returns An object containing the state(, value, and error). @note Prefer to use `TrackedAsyncData` directly! This function is provided simply for symmetry with the helper and backwards compatibility. */ -export function load(data: T | Promise): TrackedAsyncData { +function load(data: T | Promise): TrackedAsyncData { return new TrackedAsyncData(data); } - -// TODO: in v2.0.0, switch this to simply using the function above. (It needs to -// be in a breaking change because of the change in the call signature.) -const loadHelper = helper(function loadHelper([data]: [ - T | Promise -]): TrackedAsyncData { - return new TrackedAsyncData(data); -}); - -export default loadHelper; +export { load, load as default }; diff --git a/ember-async-data/type-tests/load-test.ts b/ember-async-data/type-tests/load-test.ts index 88237f50..4c97dd60 100644 --- a/ember-async-data/type-tests/load-test.ts +++ b/ember-async-data/type-tests/load-test.ts @@ -1,10 +1,6 @@ import TrackedAsyncData from '../src/tracked-async-data'; import loadHelper, { load } from '../src/helpers/load'; import { expectTypeOf } from 'expect-type'; -import { - EmptyObject, - FunctionBasedHelperInstance, -} from '@ember/component/helper'; expectTypeOf(load).toEqualTypeOf< (data: T | Promise) => TrackedAsyncData @@ -12,12 +8,6 @@ expectTypeOf(load).toEqualTypeOf< expectTypeOf(load(true)).toEqualTypeOf(new TrackedAsyncData(true)); -type LoadHelper = abstract new () => FunctionBasedHelperInstance<{ - Args: { - Positional: [T | Promise]; - Named: EmptyObject; - }; - Return: TrackedAsyncData; -}>; - -expectTypeOf(loadHelper).toEqualTypeOf(); +expectTypeOf>>().toEqualTypeOf< + TrackedAsyncData +>();