Given the following class hierarchy:
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { service } from '@ember/service';
import type { Registry as ServiceRegistry } from '@ember/service';
export default class Foo extends Component {
@service declare store: ServiceRegistry['store'];
/** I'm in the super class. */
@tracked page = 1;
}
import { computed } from '@ember/object';
import Foo from './foo';
export default class Bar extends Foo {
@computed('page')
get pageInfo(): string {
return this.page > 1 ? `Page ${this.page}` : 'First Page';
}
setPage(newPage: number): void {
console.log(this.store.findAll);
this.page = newPage;
}
}
The no-assignment-of-untracked-properties-used-in-tracking-contexts rule flags this.page = newPage; as an error because we don't use set. The IDE clearly knows the page field exists, and if you move the getPageInfo getter to the super class lint does not complain.
Given the following class hierarchy:
The
no-assignment-of-untracked-properties-used-in-tracking-contextsrule flagsthis.page = newPage;as an error because we don't useset. The IDE clearly knows thepagefield exists, and if you move thegetPageInfogetter to the super class lint does not complain.