Skip to content

Conversation

@ivanwonder
Copy link
Contributor

@ivanwonder ivanwonder commented Jun 13, 2024

When importing a component exported by default, the default can't be
used as the component name.

For example:

This is the export declarations:

export default class TestComponent {}

Previously, the output generated by LS looked like this:

import { default } from "./test.component";

Now the output looks like this:

import TestComponent from "./test.component";

Fixes #48689

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@ivanwonder ivanwonder force-pushed the import-default-export-component branch from 125e4aa to c303385 Compare June 14, 2024 14:13
@angular-robot angular-robot bot added the area: language-service Issues related to Angular's VS Code language service label Jun 14, 2024
@ngbot ngbot bot added this to the Backlog milestone Jun 14, 2024
When importing a component exported by default, the `default` can't be
used as the component name.

For example:

This is the export declarations:

```ts
export default class TestComponent {}
```

Previously, the output generated by LS looked like this:

```ts
import { default } from "./test.component";
```

Now the output looks like this:

```ts
import TestComponent from "./test.component";
```

Fixes angular#48689
@ivanwonder ivanwonder force-pushed the import-default-export-component branch from c303385 to f4ec4cc Compare June 16, 2024 12:23
@ivanwonder ivanwonder marked this pull request as ready for review June 16, 2024 12:28
@pullapprove pullapprove bot requested a review from alxhub June 16, 2024 12:28
@dylhunn dylhunn requested review from dylhunn and removed request for alxhub June 17, 2024 14:55
@dylhunn dylhunn added action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release labels Jun 17, 2024
@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit 67b2c33.

The changes were merged into the following branches: main

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: language-service Issues related to Angular's VS Code language service target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto import default exported component will break the imports

3 participants