-
Notifications
You must be signed in to change notification settings - Fork 26.2k
build: update to TypeScript 3.4 #29372
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
Conversation
Similar to #29004 |
You can preview 977f357 at https://pr29372-977f357.ngbuilds.io/. |
You can preview 16112c9 at https://pr29372-16112c9.ngbuilds.io/. |
You can preview fb59648 at https://pr29372-fb59648.ngbuilds.io/. |
You can preview f874d19 at https://pr29372-f874d19.ngbuilds.io/. |
You can preview f240b7f at https://pr29372-f240b7f.ngbuilds.io/. |
Related to angular/tsickle#1004 |
@@ -91,7 +91,7 @@ export abstract class Renderer { | |||
const renderedFiles: FileInfo[] = []; | |||
|
|||
// Transform the source files. | |||
this.bundle.src.program.getSourceFiles().map(sourceFile => { | |||
this.bundle.src.program.getSourceFiles().forEach(sourceFile => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happened here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS was showing an error here that the return value was not used: https://circleci.com/gh/angular/angular/248206
packages/compiler-cli/src/ngcc/src/rendering/renderer.ts:94:5 - error TS21222: return value is unused.
See http://tsetse.info/check-return-value
94 this.bundle.src.program.getSourceFiles().map(sourceFile => {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95 const compiledFile = decorationAnalyses.get(sourceFile);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
101 }
~~~~~~~
102 });
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting that TS3.4 will trigger that, it was not used before too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting indeed. Now that I look at it with fresh eyes, this isn't a TypeScript error proper, but a TseTse error: https://github.com/bazelbuild/rules_typescript/blob/b4bc468bfb03c05b68dde0b4f846bcd1a8fb7b01/internal/tsetse/tests/check_return_value/BUILD#L19
I wonder why TseTse wasn't catching this before.
cc @alexeagle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my guess is that we only look for usages of Array#map
, while program.getSourceFiles()
maybe was some other iterable type before like ReadonlyArray
I guess now it became assignable to Array
?
this.window.onerror(error); | ||
} else { | ||
this.window.onerror(error.message, undefined, undefined, undefined, error); | ||
if (this.window.onerror) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS 3.4 was failing compilation with the error below https://circleci.com/gh/angular/angular/248678
ERROR in src/app/shared/reporting-error-handler.ts(32,7): error TS2721: Cannot invoke an object which is possibly 'null'.
src/app/shared/reporting-error-handler.ts(34,7): error TS2721: Cannot invoke an object which is possibly 'null'.
|
||
async function callOnError(message, url, line, column, error) { | ||
await browser.executeScript(function() { | ||
// reset the ga queue | ||
(window as any).ga.q.length = 0; | ||
// post the error to the handler | ||
window.onerror(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]); | ||
if (window.onerror) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS was failing compilation with the error below https://circleci.com/gh/angular/angular/248820
[18:29:57] E/launcher - Error: TSError: ⨯ Unable to compile TypeScript
tests/e2e/onerror.e2e-spec.ts (193,7): Cannot invoke an object which is possibly 'null'. (2721)
aio/tests/e2e/onerror.e2e-spec.ts
Outdated
@@ -1,5 +1,5 @@ | |||
import { browser } from 'protractor'; | |||
import { SitePage } from './app.po'; | |||
import {browser} from 'protractor'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saving this file triggered the clang auto format. I could also save without formatting, but that begs the question of why this wasn't formatted to begin with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The files under aio/
are not formatted with clang-format
(when using gulp format
for example).
Some of the files definitely should not be formatted (e.g. aio/content/examples/
, which should follow the Angular Style Guide) and although the app files themselves (in aio/src/
) could be formatted, they historically haven't been 😁
(Note: The annoying auto-formatting will go away, once I find some time to clean-up #28842 😇)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saved without formatting then, thanks for the context.
You can preview b9bb9df at https://pr29372-b9bb9df.ngbuilds.io/. |
@filipesilva Typescript 3.4.1 is out, but your package dependencies file states |
@RinMinase this PR was just an initial test when the RC came out to see how much work would be necessary on this repository. We will change it to support a stable version before merging. |
aio/package.json
Outdated
@@ -157,7 +157,7 @@ | |||
"tree-kill": "^1.1.0", | |||
"ts-node": "^3.3.0", | |||
"tslint": "~5.9.1", | |||
"typescript": "~3.3.3333", | |||
"typescript": "~3.4.0-rc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are ready to merge this, could you update this to the released 3.4?
caretaker Igor: on your plate to clean this up and check the peerDep ranges everywhere |
You can preview 86aebb3 at https://pr29372-86aebb3.ngbuilds.io/. |
@@ -5,7 +5,8 @@ | |||
"scripts": { | |||
"build": "npm run clean && npm run ngc && npm run rollup && npm run rollup:lazy && npm run es5 && npm run es5:lazy", | |||
"clean": "rm -rf dist", | |||
"es5": "tsc --target es5 --skipLibCheck --allowJs dist/bundle.es2015.js --out dist/bundle.js", | |||
"//es5-note": "`--typeRoots ./dummy_folder_name/@types` is a workaround for https://github.com/Microsoft/TypeScript/issues/30845", | |||
"es5": "tsc --target es5 --skipLibCheck --allowJs dist/bundle.es2015.js --out dist/bundle.js --typeRoots ./dummy_folder_name/@types", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--typeRoots ./dummy_folder_name/@types
is a workaround for microsoft/TypeScript#30845.
This test does not depend on @types/node
, but they are present in the root node_modules, both via a direct dependency and transitively through the rollup
dependency.
You can preview 5835c4a at https://pr29372-5835c4a.ngbuilds.io/. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @filipesilva nice work 🌹
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the one missed version everything else looks great. Thank you.
integration/bazel-schematics/test.sh
Outdated
@@ -30,7 +30,7 @@ function testBazel() { | |||
yarn | |||
# Force more recent TS version until new Angular CLI projects also use it. | |||
# --ignore-scripts is necessary because there is a postinstall script that uses ngc. | |||
yarn add typescript@3.3.3333 --dev --ignore-scripts | |||
yarn add typescript@3.4.0-rc --dev --ignore-scripts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not 3.4.2? Did you miss to update this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I missed this one, thank you for catching it 👍
Fixed now.
You can preview 34c815b at https://pr29372-34c815b.ngbuilds.io/. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the new behavior?
Update to TS 3.4: https://devblogs.microsoft.com/typescript/announcing-typescript-3-4-rc/
Does this PR introduce a breaking change?
Other information