Skip to content

Commit

Permalink
build: TypeScript 3.5 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Jul 25, 2019
1 parent c7542a1 commit 6fff209
Show file tree
Hide file tree
Showing 34 changed files with 196 additions and 65 deletions.
77 changes: 77 additions & 0 deletions integration/typings_test_ts35/include-all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/



import * as animations from '@angular/animations';
import * as animationsBrowser from '@angular/animations/browser';
import * as animationsBrowserTesting from '@angular/animations/browser/testing';
import * as common from '@angular/common';
import * as commonHttp from '@angular/common/http';
import * as commonTesting from '@angular/common/testing';
import * as commonHttpTesting from '@angular/common/testing';
import * as compiler from '@angular/compiler';
import * as compilerTesting from '@angular/compiler/testing';
import * as core from '@angular/core';
import * as coreTesting from '@angular/core/testing';
import * as elements from '@angular/elements';
import * as forms from '@angular/forms';
// Current plan for Angular 8 is to stop building the @angular/http package
// import * as http from '@angular/http';
// import * as httpTesting from '@angular/http/testing';
import * as platformBrowser from '@angular/platform-browser';
import * as platformBrowserDynamic from '@angular/platform-browser-dynamic';
import * as platformBrowserDynamicTesting from '@angular/platform-browser-dynamic/testing';
import * as platformBrowserAnimations from '@angular/platform-browser/animations';
import * as platformBrowserTesting from '@angular/platform-browser/testing';
import * as platformServer from '@angular/platform-server';
import * as platformServerTesting from '@angular/platform-server/testing';
import * as platformWebworker from '@angular/platform-webworker';
import * as platformWebworkerDynamic from '@angular/platform-webworker-dynamic';
import * as router from '@angular/router';
import * as routerTesting from '@angular/router/testing';
import * as routerUpgrade from '@angular/router/upgrade';
import * as serviceWorker from '@angular/service-worker';
import * as upgrade from '@angular/upgrade';
import * as upgradeStatic from '@angular/upgrade/static';
import * as upgradeTesting from '@angular/upgrade/static/testing';

export default {
animations,
animationsBrowser,
animationsBrowserTesting,
common,
commonTesting,
commonHttp,
commonHttpTesting,
compiler,
compilerTesting,
core,
coreTesting,
elements,
forms,
// See above
// http,
// httpTesting,
platformBrowser,
platformBrowserTesting,
platformBrowserDynamic,
platformBrowserDynamicTesting,
platformBrowserAnimations,
platformServer,
platformServerTesting,
platformWebworker,
platformWebworkerDynamic,
router,
routerTesting,
routerUpgrade,
serviceWorker,
upgrade,
upgradeStatic,
upgradeTesting,
};
30 changes: 30 additions & 0 deletions integration/typings_test_ts35/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "angular-integration",
"description": "Assert that users with TypeScript 3.5 can type-check an Angular application",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"@angular/animations": "file:../../dist/packages-dist/animations",
"@angular/common": "file:../../dist/packages-dist/common",
"@angular/compiler": "file:../../dist/packages-dist/compiler",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/core": "file:../../dist/packages-dist/core",
"@angular/elements": "file:../../dist/packages-dist/elements",
"@angular/forms": "file:../../dist/packages-dist/forms",
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
"@angular/platform-webworker": "file:../../dist/packages-dist/platform-webworker",
"@angular/platform-webworker-dynamic": "file:../../dist/packages-dist/platform-webworker-dynamic",
"@angular/router": "file:../../dist/packages-dist/router",
"@angular/service-worker": "file:../../dist/packages-dist/service-worker",
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
"@types/jasmine": "2.5.41",
"rxjs": "file:../../node_modules/rxjs",
"typescript": "3.5.3",
"zone.js": "file:../../node_modules/zone.js"
},
"scripts": {
"test": "tsc"
}
}
24 changes: 24 additions & 0 deletions integration/typings_test_ts35/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../../dist/typings_test_ts32/",
"rootDir": ".",
"target": "es5",
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.iterable",
"es2015.promise"
],
"types": [],
"strictNullChecks": true
},
"files": [
"include-all.ts",
"node_modules/@types/jasmine/index.d.ts"
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@
"source-map": "^0.6.1",
"source-map-support": "0.5.9",
"systemjs": "0.18.10",
"tsickle": "0.34.3",
"tsickle": "0.36.0",
"tslib": "^1.9.0",
"tslint": "5.7.0",
"typescript": "~3.4.2",
"typescript": "~3.5.3",
"xhr2": "0.1.4",
"yargs": "13.1.0",
"zone.js": "^0.9.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/bazel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"peerDependencies": {
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
"@bazel/typescript": "0.*",
"typescript": ">=3.4 <3.5"
"typescript": ">=3.4 <3.6"
},
"repository": {
"type": "git",
Expand Down
16 changes: 8 additions & 8 deletions packages/bazel/test/ng_package/example_package.golden
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export * from './index';

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @license
Expand All @@ -316,7 +316,7 @@ export { MyModule } from './mymodule';

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @license
Expand All @@ -337,7 +337,7 @@ MyModule.decorators = [

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @license
Expand Down Expand Up @@ -371,7 +371,7 @@ export * from './index';

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @license
Expand Down Expand Up @@ -514,7 +514,7 @@ import { NgModule } from '@angular/core';

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class SecondaryModule {
}
Expand All @@ -526,7 +526,7 @@ const a = 1;

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/

/**
Expand All @@ -549,7 +549,7 @@ import { NgModule } from '@angular/core';

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class MyModule {
}
Expand All @@ -559,7 +559,7 @@ MyModule.decorators = [

/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/benchpress/src/metric/user_metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export class UserMetric extends Metric {
endMeasure(restart: boolean): Promise<{[key: string]: any}> {
let resolve: (result: any) => void;
let reject: (error: any) => void;
const promise = new Promise((res, rej) => {
const promise = new Promise < { [key: string]: any; }
> ((res, rej) => {
resolve = res;
reject = rej;
});
Expand Down
3 changes: 2 additions & 1 deletion packages/common/testing/src/mock_platform_location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export interface MockPlatformLocationConfig {
*
* @publicApi
*/
export const MOCK_PLATFORM_LOCATION_CONFIG = new InjectionToken('MOCK_PLATFORM_LOCATION_CONFIG');
export const MOCK_PLATFORM_LOCATION_CONFIG =
new InjectionToken<MockPlatformLocationConfig>('MOCK_PLATFORM_LOCATION_CONFIG');

/**
* Mock implementation of URL state.
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"peerDependencies": {
"@angular/compiler": "0.0.0-PLACEHOLDER",
"typescript": ">=3.4 <3.5"
"typescript": ">=3.4 <3.6"
},
"engines": {
"node": ">=8.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-cli/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ function createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback|un
}) =>
// tslint:disable-next-line:no-require-imports only depend on tsickle if requested
require('tsickle').emitWithTsickle(
program, {...tsickleHost, options, host}, host, options, targetSourceFile, writeFile,
cancellationToken, emitOnlyDtsFiles, {
program, {...tsickleHost, options, host, moduleResolutionHost: host}, host, options,
targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, {
beforeTs: customTransformers.before,
afterTs: customTransformers.after,
});
Expand Down
1 change: 1 addition & 0 deletions packages/compiler-cli/src/metadata/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface MetadataMap { [name: string]: MemberMetadata[]; }
export interface MemberMetadata {
__symbolic: 'constructor'|'method'|'property';
decorators?: (MetadataSymbolicExpression|MetadataError)[];
parameters?: (MetadataSymbolicExpression|MetadataError|null|undefined)[];
}
export function isMemberMetadata(value: any): value is MemberMetadata {
if (value) {
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/transformers/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const MIN_TS_VERSION = '3.4.0';
* ∀ supported typescript version v, v < MAX_TS_VERSION
* MAX_TS_VERSION is not considered as a supported TypeScript version
*/
const MAX_TS_VERSION = '3.5.0';
const MAX_TS_VERSION = '3.6.0';

class AngularCompilerProgram implements Program {
private rootNames: string[];
Expand Down
6 changes: 0 additions & 6 deletions packages/compiler-cli/test/diagnostics/check_types_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,6 @@ describe('ng type checker', () => {
'<div>{{"hello" | aPipe}}</div>',
`Argument of type '"hello"' is not assignable to parameter of type 'number'.`, '0:5');
});
it('should report an index into a map expression', () => {
rejectOnlyWithFullTemplateTypeCheck(
'<div>{{ {a: 1}[name] }}</div>',
`Element implicitly has an 'any' type because type '{ a: number; }' has no index signature.`,
'0:5');
});
it('should report an invalid property on an exportAs directive', () => {
rejectOnlyWithFullTemplateTypeCheck(
'<div aDir #aDir="aDir">{{aDir.fname}}</div>',
Expand Down
6 changes: 3 additions & 3 deletions packages/compiler-cli/test/metadata/collector_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Collector', () => {
version: METADATA_VERSION,
metadata: {
DeclaredClass: {__symbolic: 'class'},
declaredFn: {__symbolic: 'function'},
declaredFn: {__symbolic: 'function'} as any,
}
});
});
Expand Down Expand Up @@ -433,8 +433,8 @@ describe('Collector', () => {
}
}
},
complexFn: {__symbolic: 'function'},
declaredFn: {__symbolic: 'function'}
complexFn: {__symbolic: 'function'} as any,
declaredFn: {__symbolic: 'function'} as any,
}
});
});
Expand Down
8 changes: 4 additions & 4 deletions packages/compiler-cli/test/ngtsc/ngtsc_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3143,7 +3143,7 @@ runInEachFileSystem(os => {
const fileoverview = `
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
`;
expect(trim(jsContents).startsWith(trim(fileoverview))).toBeTruthy();
Expand All @@ -3160,7 +3160,7 @@ runInEachFileSystem(os => {
const fileoverview = `
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
`;
expect(trim(jsContents).startsWith(trim(fileoverview))).toBeTruthy();
Expand Down Expand Up @@ -3192,7 +3192,7 @@ runInEachFileSystem(os => {
* @fileoverview Some Comp overview
* @modName {some_comp}
*
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
`;
expect(trim(jsContents).startsWith(trim(fileoverview))).toBeTruthy();
Expand Down Expand Up @@ -3221,7 +3221,7 @@ runInEachFileSystem(os => {
* @fileoverview Some Comp overview
* @modName {some_comp}
*
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
`;
expect(trim(jsContents).startsWith(trim(fileoverview))).toBeTruthy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export declare class CommonModule {
`'does_not_exist' does not exist on type '{ name: string; }'`,
`Expected 2 arguments, but got 3.`,
`Argument of type '"test"' is not assignable to parameter of type 'number'`,
`Argument of type '{ name: string; }' is not assignable to parameter of type '{}[]'`,
`Argument of type '{ name: string; }' is not assignable to parameter of type 'unknown[]'`,
];

for (const error of allErrors) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/event_emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import {Subject, Subscription} from 'rxjs';
*
* @publicApi
*/
export class EventEmitter<T> extends Subject<T> {
export class EventEmitter<T extends any> extends Subject<T> {
// TODO: mark this as internal once all the facades are gone
// we can't mark it as internal now because EventEmitter exported via @angular/core would not
// contain this property making it incompatible with all the code that uses EventEmitter via
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/linker/element_ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {noop} from '../util/noop';
// Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
// i.e. users have to ask for what they need. With that, we can build better analysis tools
// and could do better codegen in the future.
export class ElementRef<T = any> {
export class ElementRef<T extends any = any> {
/**
* The underlying native element or `null` if direct access to native elements is not supported
* (e.g. when the application runs in a web worker).
Expand Down
2 changes: 1 addition & 1 deletion packages/forms/test/form_array_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {of } from 'rxjs';
function asyncValidator(expected: string, timeouts = {}) {
return (c: AbstractControl) => {
let resolve: (result: any) => void = undefined !;
const promise = new Promise(res => { resolve = res; });
const promise = new Promise<ValidationErrors|null>(res => { resolve = res; });
const t = (timeouts as any)[c.value] != null ? (timeouts as any)[c.value] : 0;
const res = c.value != expected ? {'async': true} : null;

Expand Down

0 comments on commit 6fff209

Please sign in to comment.