Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple ArrayLike imports being added #1327

Open
machty opened this issue Jan 6, 2024 · 0 comments
Open

Multiple ArrayLike imports being added #1327

machty opened this issue Jan 6, 2024 · 0 comments

Comments

@machty
Copy link

machty commented Jan 6, 2024

I'm using rehearsal fix in a piecemeal manner on some components and sometimes it causes large number of ArrayLike imports to be added to the top of the file (even though the ArrayLike import is not even referenced in the final code).

Input file:

import type ChartControls from "@futureproofretail/analytics/services/chart-controls";
import Component from "@ember/component";
import { readOnly } from "@ember/object/computed";
import { inject as service } from "@ember/service";

import classic from "ember-classic-decorator";

@classic
export default class AddMetric extends Component {
  @service
  declare chartControls: ChartControls;

  // @ts-expect-error @rehearsal TODO TS7008: Member 'metrics' implicitly has an 'any' type.
  @readOnly("chartControls.metrics") metrics;
}

Output:

import type ChartControls from "@futureproofretail/analytics/services/chart-controls";
import Component from "@ember/component";
import { readOnly } from "@ember/object/computed";
import { inject as service } from "@ember/service";

import classic from "ember-classic-decorator";
// @ts-expect-error @rehearsal TODO TS6133: The declaration 'ArrayLike' is never read or used. Remove the declaration or use it.
import { ArrayLike } from "node_modules/@glint/environment-ember-loose/-private/intrinsics/each";
// @ts-expect-error @rehearsal TODO TS2300: Duplicate identifier 'ArrayLike'.
import { ArrayLike } from "node_modules/@glint/environment-ember-loose/-private/intrinsics/each";
// @ts-expect-error @rehearsal TODO TS2300: Duplicate identifier 'ArrayLike'.
import { ArrayLike } from "node_modules/@glint/environment-ember-loose/-private/intrinsics/each";
// @ts-expect-error @rehearsal TODO TS2300: Duplicate identifier 'ArrayLike'.
import { ArrayLike } from "node_modules/@glint/environment-ember-loose/-private/intrinsics/each";
// @ts-expect-error @rehearsal TODO TS2300: Duplicate identifier 'ArrayLike'.
import { ArrayLike } from "node_modules/@glint/environment-ember-loose/-private/intrinsics/each";
// @ts-expect-error @rehearsal TODO TS2300: Duplicate identifier 'ArrayLike'.
import { ArrayLike } from "node_modules/@glint/environment-ember-loose/-private/intrinsics/each";
// @ts-expect-error @rehearsal TODO TS2300: Duplicate identifier 'ArrayLike'.
import { ArrayLike } from "node_modules/@glint/environment-ember-loose/-private/intrinsics/each";
// @ts-expect-error @rehearsal TODO TS2300: Duplicate identifier 'ArrayLike'.
import { ArrayLike } from "node_modules/@glint/environment-ember-loose/-private/intrinsics/each";
// @ts-expect-error @rehearsal TODO TS2300: Duplicate identifier 'ArrayLike'.
import { ArrayLike } from "node_modules/@glint/environment-ember-loose/-private/intrinsics/each";
// @ts-expect-error @rehearsal TODO TS2300: Duplicate identifier 'ArrayLike'.
import { ArrayLike } from "node_modules/@glint/environment-ember-loose/-private/intrinsics/each";

@classic
export default class AddMetric extends Component {
  @service
  declare chartControls: ChartControls;

  // @ts-expect-error @rehearsal TODO TS7008: Member 'metrics' implicitly has an 'any' type.
  @readOnly("chartControls.metrics") metrics;
}

I found that if I comment out the @readOnly() (FYI I'm also trying to get rid of all the readOnly's in our app), the ArrayLike's don't get created.

It's not a big deal, it doesn't happen on every file, but it typically means when running rehearsal fix that I have to manually remove all these imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant