Skip to content

fix(@ngtools/webpack): elide imports for implements keywords #16995

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

Merged
merged 1 commit into from
Feb 19, 2020
Merged

fix(@ngtools/webpack): elide imports for implements keywords #16995

merged 1 commit into from
Feb 19, 2020

Conversation

alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Feb 17, 2020

Running the remove-ivy-jit-support-calls and remove_decorators transformers causes the following TS bug microsoft/TypeScript#17552 which is why the elide-imports transformer exists in the first place.

However, when having a syntax like the below;

import { AccountComponentChild } from '../@types';
export class SignUpComponent implements AccountComponentChild{}

The implements parts of the class is called a HeritageClause with child statements of ExpressionWithTypeArguments also the same is for abstract. With this change we check the token of the HeritageClause and if it's an ImplementsKeyword we elide the import.

Closes #16907
Ref TOOL-1324

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release and removed cla: yes labels Feb 17, 2020
@angular angular deleted a comment from googlebot Feb 17, 2020
@filipesilva filipesilva requested review from clydin and removed request for filipesilva February 17, 2020 15:15
@filipesilva
Copy link
Contributor

Asking @clydin for review instead since he's more familiar with this transformer and I am mostly out of office.

@alan-agius4 alan-agius4 removed the action: merge The PR is ready for merge by the caretaker label Feb 18, 2020
@alan-agius4 alan-agius4 requested a review from clydin February 18, 2020 13:20
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Feb 18, 2020
Running the `remove-ivy-jit-support-calls` and `remove_decorators` transformers causes the following TS bug microsoft/TypeScript#17552 which is why the `elide-imports` transformer exists in the first place.

However, when having a syntax like the below;
```ts
import { AccountComponentChild } from '../@types';
export class SignUpComponent implements AccountComponentChild{}
```

The `implements` parts of the class is called a `HeritageClause` with child statements of `ExpressionWithTypeArguments` also the same is for `abstract`. With this change we check the token of the `HeritageClause` and if it's an `ImplementsKeyword` we elide the import.

Closes #16907
@kyliau kyliau merged commit 1deca8a into angular:master Feb 19, 2020
@alan-agius4 alan-agius4 deleted the token-express-type branch February 19, 2020 18:25
@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 Mar 21, 2020
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 target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Webpack complain about d.ts
5 participants