import { DirectInvokable } from '@glint/template/-private/integration'; import ObjectProxy from '@ember/object/proxy'; import '@ember/object/-private/types'; // This hack lets us support both the stable/preview types from `ember-source` // and the classic types still live on DefinitelyTyped. If using the DT types, // this acts as a declaration merge for a module which is then integrated via // the rest of the DT types. If using the stable/preview types, this ends up // being a no-op. declare const GetSetMarker: unique symbol; declare module '@ember/object/-private/types' { interface ComputedPropertyMarker { [GetSetMarker]: [Get, Set]; } } type UnwrapComputedPropertyGetter = T extends { [GetSetMarker]: [infer U, any] } ? U : T; export type GetHelper = DirectInvokable<{ (obj: T, key: K): UnwrapComputedPropertyGetter; (obj: T | null | undefined, key: K): | UnwrapComputedPropertyGetter | undefined; (obj: ObjectProxy | null | undefined, key: K): | UnwrapComputedPropertyGetter | undefined; (obj: null | undefined, key: string): undefined; (obj: unknown, key: string): unknown; }>;