Skip to content

Incompatible types on yielded block #1128

Closed
@MichalBryxi

Description

@MichalBryxi

Assuming following code:

import Component from '@glimmer/component';
import { service } from '@ember/service';
import type SettingsService from 'the-mountains-are-calling/services/settings';
import { firebaseQuery } from 'the-mountains-are-calling/builders/firebase';
import { use, cell, resource, type Reactive } from 'ember-resources';
import { Cell } from '@starbeam/universal';

export type ClockNakedSignature = {
  percentage: Cell<number>;
  counter: Cell<number>;
};

export type ClockSignature = Reactive<ClockNakedSignature>;

interface Signature {
  Args: {};
  Blocks: {
    default: [ClockNakedSignature];
  };
  Element: HTMLDivElement;
}

const Clock = resource(({ on }) => {
  const counter = cell(0);
  const percentage = cell(0);

  return { percentage, counter };
});

export default class Refresher extends Component<Signature> {
  clock = use(this, Clock);

  <template>{{yield this.clock}}</template>
}

The line clock = use(this, Clock); reports following error:

Public property 'clock' of exported class has or is using name 'CURRENT' from external module "/Users/michal/pudr.com/the-mountains-are-calling/node_modules/.pnpm/ember-resources@7.0.0_@glimmer+component@1.1.2_@glimmer+tracking@1.1.2_@glint+template@1.4.0_ember-source@5.6.0/node_modules/ember-resources/declarations/index" but cannot be named.glint(4029)

And line <template>{{yield this.clock}}</template> reports following error:

Argument of type 'Reactive<{ percentage: Cell<number>; counter: Cell<number>; }>' is not assignable to parameter of type 'ClockNakedSignature'.
  Type 'Reactive<{ percentage: Cell<number>; counter: Cell<number>; }>' is missing the following properties from type 'ClockNakedSignature': percentage, counterglint(2345)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions