Skip to content

Commit

Permalink
Merge pull request #623 from ro0gr/relax-getter-type
Browse files Browse the repository at this point in the history
relax `getter` types a bit
  • Loading branch information
ro0gr authored Oct 2, 2023
2 parents cd28086 + 26b4c57 commit 1119e05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion addon/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ declare module 'ember-cli-page-object/extend' {
declare module 'ember-cli-page-object/macros' {
import { Component, GetterDescriptor } from 'ember-cli-page-object/-private';

function getter<P extends Record<string, unknown>, T = any>
function getter<P, T = any>
(body: (this: Component<P>, key: string) => T)
: GetterDescriptor<T>;

Expand Down
6 changes: 3 additions & 3 deletions test-app/tests/unit/-private/properties/getter-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module('getter', function(hooks) {
test('executes the passed-in function with the correct context for `this`', async function (this: TestContext, assert) {
assert.expect(1);

type Getter<T> = ReturnType<typeof getter<Record<string, unknown>, T>>;
type Getter<T> = ReturnType<typeof getter<unknown, T>>;

type Definition = {
inputValue: Getter<string>,
Expand Down Expand Up @@ -59,7 +59,7 @@ module('getter', function(hooks) {
assert.expect(2);

const page = create({
foo: getter(function(key: string) {
foo: getter(function(key) {
assert.equal(key, 'foo');
return true;
})
Expand Down Expand Up @@ -108,7 +108,7 @@ PageObject: \'page.foo\'`)
assert.expect(1);

const page = create({
foo: getter(function(this: any) {
foo: getter(function() {
findOne(this, '.non-existing-scope');
}),
});
Expand Down

0 comments on commit 1119e05

Please sign in to comment.