Skip to content

Update Angular to support TS 3.9#36989

Closed
petebacondarwin wants to merge 26 commits into
angular:masterfrom
petebacondarwin:ts3-9
Closed

Update Angular to support TS 3.9#36989
petebacondarwin wants to merge 26 commits into
angular:masterfrom
petebacondarwin:ts3-9

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented May 7, 2020

Copy link
Copy Markdown
Contributor

This is a big PR with lots of commits. But most are in the compiler or are just tweaks to tests. So hopefully it will not be too arduous to review. It will be easier to go commit by commit when reviewing.

@googlebot

This comment has been minimized.

crisbeto added a commit to crisbeto/material2 that referenced this pull request May 8, 2020
The Framework team is in the process of updating to TS 3.9 (see angular/angular#36989) which means that soon we'll have to switch to it as well. These changes update us to the latest RC and resolve all of the build issues so that we can quickly switch to the final version once it's available.
Comment thread packages/compiler-cli/ngcc/index.ts Outdated
jelbourn pushed a commit to angular/components that referenced this pull request May 8, 2020
The Framework team is in the process of updating to TS 3.9 (see angular/angular#36989) which means that soon we'll have to switch to it as well. These changes update us to the latest RC and resolve all of the build issues so that we can quickly switch to the final version once it's available.
Comment thread integration/BUILD.bazel Outdated
trik pushed a commit to gnucoop/ajf that referenced this pull request May 11, 2020
The Angular team is in the process of updating to TS 3.9 (see angular/angular#36989) which means that soon we'll have to switch to it as well. These changes update us to the latest RC and resolve all of the build issues so that we can quickly switch to the final version once it's available.
@petebacondarwin petebacondarwin added area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime comp: ngcc labels May 11, 2020
@ngbot ngbot Bot modified the milestone: needsTriage May 11, 2020
@petebacondarwin petebacondarwin added the refactoring Issue that involves refactoring or code-cleanup label May 11, 2020
trik pushed a commit to gnucoop/gngt that referenced this pull request May 11, 2020
The Angular team is in the process of updating to TS 3.9 (see angular/angular#36989) which means that soon we'll have to switch to it as well. These changes update us to the latest RC and resolve all of the build issues so that we can quickly switch to the final version once it's available.
@petebacondarwin petebacondarwin force-pushed the ts3-9 branch 3 times, most recently from 7322661 to 822bd51 Compare May 12, 2020 07:23
@alan-agius4 alan-agius4 force-pushed the ts3-9 branch 2 times, most recently from 845573e to 904c60f Compare May 12, 2020 13:15
@alan-agius4

This comment has been minimized.

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

alan-agius4 and others added 6 commits May 13, 2020 17:10
With this changer we update the CLI size-tracking changes for uncompressed
main-es2015 file. This file is larger due to new emitted shape of
ES2015 classes in TypeScript 3.9, which are now wrapped in IIFE.
This is a workaround for a TS 3.9 regression microsoft/TypeScript#38501 where the emitted `__exportStar` helpers have a missing semi-colon at the end of the unnamed function, when targetting UMD, and causes the following runtime error `Uncaught TypeError: (intermediate value)(…) is not a function`.

This is because the anonymous `__exportStar` function will be invoked with the function on the next like as the parameter which is subsequently invoking whatever was returned.

To get around this TS bug, add `importHelpers: true` in your tsconfig. This also, is recommanded to avoid multiple copies of the same helper being inlined, which might cause increase in bundle size.
`cli-hello-world-lazy-rollup` fails on a bundle size check because Ivy and VE main-es2015 sizes are different
TypeScript 3.9 introduced a breaking change where extends `any` no longer acts as `any`, instead it acts as `unknown`.

With this change we retain the behavior we had with TS 3.8 which is;

When using the `EventEmitter` as a type you must always provide a  type;
```ts
let emitter: EventEmitter<string>
```

and when initializing the `EventEmitter` class you can either provide a  type or or use the fallback type which is `any`

```ts
const emitter = new EventEmitter(); // EventEmitter<any>
const emitter = new EventEmitte<string>(); // EventEmitter<string>
``
With this change we update the expect of the `module resolution cache` were in the second count with cache the `fileExists` is called less then 700 times.
In the code base there are cases where there is, conceptually, a class
that is represented by a combination of an `interface`
(type declaration) and a `const` (value declaration).

For example:

```
export interface SomeClass {
  count(a?: string): number;
}
export const: SomeClass = class {
  someMethod(a: string = ''): number { ... }
};
```

These were being rendered as interfaces and also not
correctly showing the descriptions and default parameter
values.

In this commit such concepts are now rendered as classes.
The classes that are affected by this are:

* `DebugElement`
* `DebugNode`
* `Type`
* `EventEmitter`
* `TestBed`

Note that while decorators are also defined in this form
they have their own rendering type (`decorator`) and so
are not affecte by this.
@IgorMinar

Copy link
Copy Markdown
Contributor

@petebacondarwin your suggestion worked and the code is now fully compatible with closure! yay! awesome job!

I resolved the merge conflict that occured due to recent merges upstream, updated the payload sizes for aio-local, rebased the branch, force-pushed, and kicked of a g3sync presubmit.

Hopefully this will make the PR go green 🤞

@mary-poppins

Copy link
Copy Markdown

You can preview d53f40e at https://pr36989-d53f40e.ngbuilds.io/.

@googlebot

Copy link
Copy Markdown

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot

Copy link
Copy Markdown

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@IgorMinar

IgorMinar commented May 14, 2020

Copy link
Copy Markdown
Contributor

presubmit

@mary-poppins

Copy link
Copy Markdown

You can preview 11cf068 at https://pr36989-11cf068.ngbuilds.io/.

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@petebacondarwin petebacondarwin removed the action: presubmit The PR is in need of a google3 presubmit label May 14, 2020
@kara kara closed this in c42f35e May 14, 2020
kara pushed a commit that referenced this pull request May 14, 2020
…6989)

In TypeScript 3.9, type nodes need to exist in the context of a statement.
This commit ensures that the synthetic type node has such a parent.

PR Close #36989
kara pushed a commit that referenced this pull request May 14, 2020
…e program (#36989)

In TypeScript 3.9, the compiler is able to re-use (i.e. not invalidate)
the previous program if only external templates (i.e. no TS files) have
changed.

PR Close #36989
kara pushed a commit that referenced this pull request May 14, 2020
- Fix several compilation errors
- Update @microsoft/api-extractor to be compatible with TypeScript 3.9

PR Close #36989
kara pushed a commit that referenced this pull request May 14, 2020
…6989)

A number of overloads were added to `detectKnownDeclaration()` to
allow it to support `null` being passed through. In practice this could
easily be avoided, which allows the overloads to be removed and the
method signature and implementations to be simplified.

PR Close #36989
kara pushed a commit that referenced this pull request May 14, 2020
…t.isClass()` (#36989)

The comment in this function confused me, so I updated it to clarify that
`isClass()` is not true for un-named classes.

Also, I took the opportunity to use a helper method to simplify the function
itself.

PR Close #36989
kara pushed a commit that referenced this pull request May 14, 2020
…ression()` (#36989)

The previous implementations of `hasBaseClass()` are almost
identical to the implementation of `getBaseClassExpression()`.
There is little benefit in duplicating this code so this refactoring
changes `hasBaseClass()` to just call `getBaseClassExpression()`.
This allows the various hosts that implement this to be simplified.

PR Close #36989
@angular-automatic-lock-bot

Copy link
Copy Markdown

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.

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: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime cla: yes refactoring Issue that involves refactoring or code-cleanup target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.