diff --git a/build.sh b/build.sh index 9690b0ddcd..269d6719b2 100755 --- a/build.sh +++ b/build.sh @@ -409,6 +409,10 @@ if [[ ${BUILD_ALL} == true && ${TYPECHECK_ALL} == true ]]; then travisFoldStart "tsc -p ${TSCONFIG}" "no-xtrace" $TSC -p ${TSCONFIG} travisFoldEnd "tsc -p ${TSCONFIG}" + TSCONFIG="packages/examples/tsconfig.json" + travisFoldStart "tsc -p ${TSCONFIG}" "no-xtrace" + $TSC -p ${TSCONFIG} + travisFoldEnd "tsc -p ${TSCONFIG}" TSCONFIG="modules/tsconfig.json" travisFoldStart "tsc -p ${TSCONFIG}" "no-xtrace" $TSC -p ${TSCONFIG} diff --git a/integration/dynamic-compiler/e2e/tsconfig.json b/integration/dynamic-compiler/e2e/tsconfig.json index 2badee6f7a..c560c74bad 100644 --- a/integration/dynamic-compiler/e2e/tsconfig.json +++ b/integration/dynamic-compiler/e2e/tsconfig.json @@ -1,7 +1,10 @@ { "compilerOptions": { "outDir": "../dist/e2e", - "types": ["jasmine"], + "types": [ + "jasmine", + "jasminewd2" + ], "skipLibCheck": true } } diff --git a/integration/dynamic-compiler/package.json b/integration/dynamic-compiler/package.json index 24c178f7e0..71f48d5a38 100644 --- a/integration/dynamic-compiler/package.json +++ b/integration/dynamic-compiler/package.json @@ -18,8 +18,9 @@ }, "license": "MIT", "devDependencies": { - "@types/jasmine": "file:../../node_modules/@types/jasmine", "@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli", + "@types/jasmine": "file:../../node_modules/@types/jasmine", + "@types/jasminewd2": "file:../../node_modules/@types/jasminewd2", "concurrently": "3.4.0", "lite-server": "2.2.2", "protractor": "file:../../node_modules/protractor", diff --git a/modules/types.d.ts b/modules/types.d.ts index 009398d12f..0dbf2fff2b 100644 --- a/modules/types.d.ts +++ b/modules/types.d.ts @@ -8,10 +8,11 @@ // This file contains all ambient imports needed to compile the modules/ source code -/// /// /// +/// /// -/// +/// +/// /// /// diff --git a/package.json b/package.json index a40c4f1e49..2d42212d1c 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@types/diff": "^3.2.2", "@types/fs-extra": "4.0.2", "@types/hammerjs": "2.0.35", - "@types/jasmine": "2.2.22-alpha", + "@types/jasmine": "^2.8.8", + "@types/jasminewd2": "^2.0.3", "@types/minimist": "^1.2.0", "@types/node": "6.0.88", "@types/selenium-webdriver": "3.0.7", @@ -84,8 +85,8 @@ "hammerjs": "2.0.8", "husky": "^0.14.3", "incremental-dom": "0.4.1", - "jasmine": "2.4.1", - "jasmine-core": "2.4.1", + "jasmine": "2.8", + "jasmine-core": "2.8", "jpm": "1.3.1", "karma": "0.13.20", "karma-browserstack-launcher": "0.1.9", diff --git a/packages/bazel/test/ngc-wrapped/test_support.ts b/packages/bazel/test/ngc-wrapped/test_support.ts index eec4cb8ee0..3e331f66d4 100644 --- a/packages/bazel/test/ngc-wrapped/test_support.ts +++ b/packages/bazel/test/ngc-wrapped/test_support.ts @@ -30,7 +30,7 @@ export interface TestSupport { writeFiles(...mockDirs: {[fileName: string]: string}[]): void; shouldExist(fileName: string): void; shouldNotExist(fileName: string): void; - runOneBuild(): void; + runOneBuild(): boolean; } export function setup( diff --git a/packages/benchpress/test/metric/user_metric_spec.ts b/packages/benchpress/test/metric/user_metric_spec.ts index 15e8a1b85f..0225154a58 100644 --- a/packages/benchpress/test/metric/user_metric_spec.ts +++ b/packages/benchpress/test/metric/user_metric_spec.ts @@ -48,13 +48,11 @@ import {Options, PerfLogEvent, PerfLogFeatures, UserMetric, WebDriverAdapter} fr const metric = createMetric( [[]], new PerfLogFeatures(), {userMetrics: {'loadTime': 'time to load', 'content': 'time to see content'}}); - metric.beginMeasure() - .then((_) => metric.endMeasure(true)) - .then((values: {[key: string]: string}) => { - expect(values['loadTime']).toBe(25); - expect(values['content']).toBe(250); - async.done(); - }); + metric.beginMeasure().then(() => metric.endMeasure(true)).then(values => { + expect(values['loadTime']).toBe(25); + expect(values['content']).toBe(250); + async.done(); + }); wdAdapter.data['loadTime'] = 25; // Wait before setting 2nd property. diff --git a/packages/common/test/directives/ng_component_outlet_spec.ts b/packages/common/test/directives/ng_component_outlet_spec.ts index 9a8acd16ce..39f0b3d317 100644 --- a/packages/common/test/directives/ng_component_outlet_spec.ts +++ b/packages/common/test/directives/ng_component_outlet_spec.ts @@ -166,12 +166,12 @@ import {expect} from '@angular/platform-browser/testing/src/matchers'; fixture.componentInstance.currentComponent = Module2InjectedComponent; fixture.detectChanges(); - const moduleRef = fixture.componentInstance.ngComponentOutlet['_moduleRef']; + const moduleRef = fixture.componentInstance.ngComponentOutlet['_moduleRef'] !; spyOn(moduleRef, 'destroy').and.callThrough(); - expect(moduleRef !.destroy).not.toHaveBeenCalled(); + expect(moduleRef.destroy).not.toHaveBeenCalled(); fixture.destroy(); - expect(moduleRef !.destroy).toHaveBeenCalled(); + expect(moduleRef.destroy).toHaveBeenCalled(); })); it('should not re-create moduleRef when it didn\'t actually change', async(() => { diff --git a/packages/compiler-cli/integrationtest/ngtools_src/feature2/feature2.module.ts b/packages/compiler-cli/integrationtest/ngtools_src/feature2/feature2.module.ts index 196bcba850..7e0c5f0a51 100644 --- a/packages/compiler-cli/integrationtest/ngtools_src/feature2/feature2.module.ts +++ b/packages/compiler-cli/integrationtest/ngtools_src/feature2/feature2.module.ts @@ -16,10 +16,9 @@ export class FeatureComponent { @NgModule({ declarations: [FeatureComponent], imports: [RouterModule.forChild([ - {path: '', component: FeatureComponent}, {path: 'd', loadChildren: './default.module'} { - path: 'e', - loadChildren: 'feature/feature.module#FeatureModule' - } + {path: '', component: FeatureComponent}, + {path: 'd', loadChildren: './default.module'}, + {path: 'e', loadChildren: 'feature/feature.module#FeatureModule'}, ])] }) export class Feature2Module { diff --git a/packages/compiler-cli/src/ngtools_api.ts b/packages/compiler-cli/src/ngtools_api.ts index d08f6a226e..665aed0e08 100644 --- a/packages/compiler-cli/src/ngtools_api.ts +++ b/packages/compiler-cli/src/ngtools_api.ts @@ -21,7 +21,7 @@ import * as ts from 'typescript'; -import {CompilerHost, CompilerOptions, LazyRoute} from './transformers/api'; +import {CompilerOptions} from './transformers/api'; import {getOriginalReferences} from './transformers/compiler_host'; import {createProgram} from './transformers/entry_points'; diff --git a/packages/compiler-cli/test/diagnostics/expression_diagnostics_spec.ts b/packages/compiler-cli/test/diagnostics/expression_diagnostics_spec.ts index 74b0574719..f3e4c304a2 100644 --- a/packages/compiler-cli/test/diagnostics/expression_diagnostics_spec.ts +++ b/packages/compiler-cli/test/diagnostics/expression_diagnostics_spec.ts @@ -76,7 +76,7 @@ describe('expression diagnostics', () => { } } - function reject(template: string, expected: string | RegExp) { + function reject(template: string, expected: string) { const info = getDiagnosticTemplateInfo(context, type, 'app/app.component.html', template); if (info) { const diagnostics = getTemplateExpressionDiagnostics(info); @@ -240,4 +240,4 @@ const FILES: Directory = { ` } } -}; \ No newline at end of file +}; diff --git a/packages/compiler-cli/test/metadata/collector_spec.ts b/packages/compiler-cli/test/metadata/collector_spec.ts index e49149569d..138473d7f1 100644 --- a/packages/compiler-cli/test/metadata/collector_spec.ts +++ b/packages/compiler-cli/test/metadata/collector_spec.ts @@ -9,7 +9,7 @@ import * as ts from 'typescript'; import {MetadataCollector} from '../../src/metadata/collector'; -import {ClassMetadata, ConstructorMetadata, METADATA_VERSION, MetadataEntry, ModuleMetadata, isClassMetadata, isMetadataGlobalReferenceExpression} from '../../src/metadata/schema'; +import {ClassMetadata, ConstructorMetadata, METADATA_VERSION, MetadataEntry, MetadataMap, MetadataSymbolicExpression, ModuleMetadata, isClassMetadata, isMetadataGlobalReferenceExpression} from '../../src/metadata/schema'; import {Directory, Host, expectValidSources} from './typescript.mocks'; @@ -269,9 +269,11 @@ describe('Collector', () => { it('should provide any reference for an any ctor parameter type', () => { const casesAny = casesMetadata.metadata['CaseAny']; expect(casesAny).toBeTruthy(); - const ctorData = casesAny.members !['__ctor__']; - expect(ctorData).toEqual( - [{__symbolic: 'constructor', parameters: [{__symbolic: 'reference', name: 'any'}]}]); + const ctorData = casesAny.members !['__ctor__'] as ConstructorMetadata[]; + expect(ctorData).toEqual([{ + __symbolic: 'constructor', + parameters: [{__symbolic: 'reference', name: 'any'} as MetadataSymbolicExpression] + }]); }); it('should record annotations on set and get declarations', () => { @@ -285,7 +287,8 @@ describe('Collector', () => { arguments: ['firstName'] }] }] - }); + } as any as MetadataMap); // TODO: Review use of `any` here (#19904) + const caseGetProp = casesMetadata.metadata['GetProp']; expect(caseGetProp.members).toEqual(propertyData(11)); const caseSetProp = casesMetadata.metadata['SetProp']; @@ -297,8 +300,7 @@ describe('Collector', () => { it('should record references to parameterized types', () => { const casesForIn = casesMetadata.metadata['NgFor']; expect(casesForIn).toEqual({ - __symbolic: 'class', - decorators: [{ + __symbolic: 'class', decorators: [{ __symbolic: 'call', expression: { __symbolic: 'reference', @@ -308,17 +310,17 @@ describe('Collector', () => { character: 7 } }], - members: { - __ctor__: [{ - __symbolic: 'constructor', - parameters: [{ - __symbolic: 'reference', - name: 'ClassReference', - arguments: [{__symbolic: 'reference', name: 'NgForRow'}] - }] - }] - } - }); + members: { + __ctor__: [{ + __symbolic: 'constructor', + parameters: [{ + __symbolic: 'reference', + name: 'ClassReference', + arguments: [{__symbolic: 'reference', name: 'NgForRow'}] + }] + }] + } + } as any as ClassMetadata); // TODO: Review use of `any` here (#19904) }); it('should report errors for destructured imports', () => { @@ -358,9 +360,9 @@ describe('Collector', () => { const someClass = metadata.metadata['SomeClass']; const ctor = someClass.members !['__ctor__'][0]; const parameters = ctor.parameters; - expect(parameters).toEqual([ - {__symbolic: 'reference', module: 'angular2/common', name: 'NgFor', line: 6, character: 29} - ]); + expect(parameters).toEqual([{ + __symbolic: 'reference', module: 'angular2/common', name: 'NgFor', line: 6, character: 29 + } as MetadataSymbolicExpression]); }); it('should record all exported classes', () => { @@ -443,9 +445,9 @@ describe('Collector', () => { const someClass = metadata.metadata['SomeClass']; const ctor = someClass.members !['__ctor__'][0]; const parameters = ctor.parameters; - expect(parameters).toEqual([ - {__symbolic: 'reference', module: 'angular2/common', name: 'NgFor', line: 6, character: 29} - ]); + expect(parameters).toEqual([{ + __symbolic: 'reference', module: 'angular2/common', name: 'NgFor', line: 6, character: 29 + } as MetadataSymbolicExpression]); }); it('should be able to collect the value of an enum', () => { @@ -533,7 +535,7 @@ describe('Collector', () => { arguments: ['a'] } }] - }]); + }] as any as MetadataSymbolicExpression[]); // TODO: Review use of `any` here (#19904) }); it('should be able to collect a static field', () => { @@ -576,7 +578,7 @@ describe('Collector', () => { } }] }] - }]); + }] as any as MetadataSymbolicExpression[]); // TODO: Review use of `any` here (#19904) }); it('should be able to collect a method with a conditional expression', () => { @@ -764,7 +766,7 @@ describe('Collector', () => { }]], parameters: [{__symbolic: 'reference', name: 'any'}] }] - }); + } as any as MetadataMap); // TODO: Review use of `any` here (#19904) }); describe('with interpolations', () => { @@ -868,7 +870,7 @@ describe('Collector', () => { {__symbolic: 'reference', module: './foo', name: 'Foo', line: 3, character: 24} ] }] - }); + } as any as MetadataMap); // TODO: Review use of `any` here (#19904) }); it('should treat exported class expressions as a class', () => { diff --git a/packages/compiler-cli/test/ngc_spec.ts b/packages/compiler-cli/test/ngc_spec.ts index f7264872e3..ca4d822aa0 100644 --- a/packages/compiler-cli/test/ngc_spec.ts +++ b/packages/compiler-cli/test/ngc_spec.ts @@ -1747,7 +1747,7 @@ describe('ngc transformer command-line', () => { const exitCode = main(['-p', path.join(basePath, 'src/tsconfig.json')], message => messages.push(message)); expect(exitCode).toBe(1, 'Compile was expected to fail'); - expect(messages[0]).toContain(['Tagged template expressions are not supported in metadata']); + expect(messages[0]).toContain('Tagged template expressions are not supported in metadata'); }); // Regression: #20076 diff --git a/packages/compiler-cli/test/transformers/node_emitter_spec.ts b/packages/compiler-cli/test/transformers/node_emitter_spec.ts index 6eddfd22d1..353a0c0a64 100644 --- a/packages/compiler-cli/test/transformers/node_emitter_spec.ts +++ b/packages/compiler-cli/test/transformers/node_emitter_spec.ts @@ -502,7 +502,7 @@ describe('TypeScriptNodeEmitter', () => { generatedColumn: 0, originalLine: 1, originalColumn: 0, - name: null + name: null ! // TODO: Review use of `!` here (#19904) }, { source: sourceUrl, @@ -510,7 +510,7 @@ describe('TypeScriptNodeEmitter', () => { generatedColumn: 16, originalLine: 1, originalColumn: 26, - name: null + name: null ! // TODO: Review use of `!` here (#19904) } ]); }); diff --git a/packages/compiler-cli/test/transformers/program_spec.ts b/packages/compiler-cli/test/transformers/program_spec.ts index 6fee0ea657..7a93043277 100644 --- a/packages/compiler-cli/test/transformers/program_spec.ts +++ b/packages/compiler-cli/test/transformers/program_spec.ts @@ -373,8 +373,8 @@ describe('ng program', () => { {rootNames: [path.resolve(testSupport.basePath, 'src/main.ts')], options, host}); program.loadNgStructureAsync().then(() => { program.emit(); - const factory = - fs.readFileSync(path.resolve(testSupport.basePath, 'built/src/main.ngfactory.js')); + const ngFactoryPath = path.resolve(testSupport.basePath, 'built/src/main.ngfactory.js'); + const factory = fs.readFileSync(ngFactoryPath, 'utf8'); expect(factory).toContain('Hello world!'); done(); }); @@ -677,8 +677,9 @@ describe('ng program', () => { program.listLazyRoutes(); program.emit(); - const lazyNgFactory = - fs.readFileSync(path.resolve(testSupport.basePath, 'built/src/lazy/lazy.ngfactory.js')); + const ngFactoryPath = path.resolve(testSupport.basePath, 'built/src/lazy/lazy.ngfactory.js'); + const lazyNgFactory = fs.readFileSync(ngFactoryPath, 'utf8'); + expect(lazyNgFactory).toContain('import * as i1 from "./lazy";'); }); @@ -735,8 +736,10 @@ describe('ng program', () => { expect(normalizeRoutes(program.listLazyRoutes('src/main#MainModule'))).toEqual([ { module: {name: 'MainModule', filePath: path.resolve(testSupport.basePath, 'src/main.ts')}, - referencedModule: - {name: undefined, filePath: path.resolve(testSupport.basePath, 'src/child.ts')}, + referencedModule: { + name: undefined as any as string, // TODO: Review use of `any` here (#19904) + filePath: path.resolve(testSupport.basePath, 'src/child.ts') + }, route: './child' }, ]); diff --git a/packages/compiler/test/core_spec.ts b/packages/compiler/test/core_spec.ts index c28abf31d9..f5864584cc 100644 --- a/packages/compiler/test/core_spec.ts +++ b/packages/compiler/test/core_spec.ts @@ -103,83 +103,86 @@ import * as core from '@angular/core'; }); it('const enums should be equal', () => { - expect(compilerCore.NodeFlags.None).toBe(core.ɵNodeFlags.None); - expect(compilerCore.NodeFlags.TypeElement).toBe(core.ɵNodeFlags.TypeElement); - expect(compilerCore.NodeFlags.TypeText).toBe(core.ɵNodeFlags.TypeText); - expect(compilerCore.NodeFlags.ProjectedTemplate).toBe(core.ɵNodeFlags.ProjectedTemplate); - expect(compilerCore.NodeFlags.CatRenderNode).toBe(core.ɵNodeFlags.CatRenderNode); - expect(compilerCore.NodeFlags.TypeNgContent).toBe(core.ɵNodeFlags.TypeNgContent); - expect(compilerCore.NodeFlags.TypePipe).toBe(core.ɵNodeFlags.TypePipe); - expect(compilerCore.NodeFlags.TypePureArray).toBe(core.ɵNodeFlags.TypePureArray); - expect(compilerCore.NodeFlags.TypePureObject).toBe(core.ɵNodeFlags.TypePureObject); - expect(compilerCore.NodeFlags.TypePurePipe).toBe(core.ɵNodeFlags.TypePurePipe); - expect(compilerCore.NodeFlags.CatPureExpression).toBe(core.ɵNodeFlags.CatPureExpression); - expect(compilerCore.NodeFlags.TypeValueProvider).toBe(core.ɵNodeFlags.TypeValueProvider); - expect(compilerCore.NodeFlags.TypeClassProvider).toBe(core.ɵNodeFlags.TypeClassProvider); - expect(compilerCore.NodeFlags.TypeFactoryProvider).toBe(core.ɵNodeFlags.TypeFactoryProvider); - expect(compilerCore.NodeFlags.TypeUseExistingProvider) - .toBe(core.ɵNodeFlags.TypeUseExistingProvider); - expect(compilerCore.NodeFlags.LazyProvider).toBe(core.ɵNodeFlags.LazyProvider); - expect(compilerCore.NodeFlags.PrivateProvider).toBe(core.ɵNodeFlags.PrivateProvider); - expect(compilerCore.NodeFlags.TypeDirective).toBe(core.ɵNodeFlags.TypeDirective); - expect(compilerCore.NodeFlags.Component).toBe(core.ɵNodeFlags.Component); - expect(compilerCore.NodeFlags.CatProviderNoDirective) - .toBe(core.ɵNodeFlags.CatProviderNoDirective); - expect(compilerCore.NodeFlags.CatProvider).toBe(core.ɵNodeFlags.CatProvider); - expect(compilerCore.NodeFlags.OnInit).toBe(core.ɵNodeFlags.OnInit); - expect(compilerCore.NodeFlags.OnDestroy).toBe(core.ɵNodeFlags.OnDestroy); - expect(compilerCore.NodeFlags.DoCheck).toBe(core.ɵNodeFlags.DoCheck); - expect(compilerCore.NodeFlags.OnChanges).toBe(core.ɵNodeFlags.OnChanges); - expect(compilerCore.NodeFlags.AfterContentInit).toBe(core.ɵNodeFlags.AfterContentInit); - expect(compilerCore.NodeFlags.AfterContentChecked).toBe(core.ɵNodeFlags.AfterContentChecked); - expect(compilerCore.NodeFlags.AfterViewInit).toBe(core.ɵNodeFlags.AfterViewInit); - expect(compilerCore.NodeFlags.AfterViewChecked).toBe(core.ɵNodeFlags.AfterViewChecked); - expect(compilerCore.NodeFlags.EmbeddedViews).toBe(core.ɵNodeFlags.EmbeddedViews); - expect(compilerCore.NodeFlags.ComponentView).toBe(core.ɵNodeFlags.ComponentView); - expect(compilerCore.NodeFlags.TypeContentQuery).toBe(core.ɵNodeFlags.TypeContentQuery); - expect(compilerCore.NodeFlags.TypeViewQuery).toBe(core.ɵNodeFlags.TypeViewQuery); - expect(compilerCore.NodeFlags.StaticQuery).toBe(core.ɵNodeFlags.StaticQuery); - expect(compilerCore.NodeFlags.DynamicQuery).toBe(core.ɵNodeFlags.DynamicQuery); - expect(compilerCore.NodeFlags.CatQuery).toBe(core.ɵNodeFlags.CatQuery); - expect(compilerCore.NodeFlags.Types).toBe(core.ɵNodeFlags.Types); + const expectToBe = (val1: any, val2: any) => expect(val1).toBe(val2); - expect(compilerCore.DepFlags.None).toBe(core.ɵDepFlags.None); - expect(compilerCore.DepFlags.SkipSelf).toBe(core.ɵDepFlags.SkipSelf); - expect(compilerCore.DepFlags.Optional).toBe(core.ɵDepFlags.Optional); - expect(compilerCore.DepFlags.Value).toBe(core.ɵDepFlags.Value); + expectToBe(compilerCore.NodeFlags.None, core.ɵNodeFlags.None); + expectToBe(compilerCore.NodeFlags.TypeElement, core.ɵNodeFlags.TypeElement); + expectToBe(compilerCore.NodeFlags.TypeText, core.ɵNodeFlags.TypeText); + expectToBe(compilerCore.NodeFlags.ProjectedTemplate, core.ɵNodeFlags.ProjectedTemplate); + expectToBe(compilerCore.NodeFlags.CatRenderNode, core.ɵNodeFlags.CatRenderNode); + expectToBe(compilerCore.NodeFlags.TypeNgContent, core.ɵNodeFlags.TypeNgContent); + expectToBe(compilerCore.NodeFlags.TypePipe, core.ɵNodeFlags.TypePipe); + expectToBe(compilerCore.NodeFlags.TypePureArray, core.ɵNodeFlags.TypePureArray); + expectToBe(compilerCore.NodeFlags.TypePureObject, core.ɵNodeFlags.TypePureObject); + expectToBe(compilerCore.NodeFlags.TypePurePipe, core.ɵNodeFlags.TypePurePipe); + expectToBe(compilerCore.NodeFlags.CatPureExpression, core.ɵNodeFlags.CatPureExpression); + expectToBe(compilerCore.NodeFlags.TypeValueProvider, core.ɵNodeFlags.TypeValueProvider); + expectToBe(compilerCore.NodeFlags.TypeClassProvider, core.ɵNodeFlags.TypeClassProvider); + expectToBe(compilerCore.NodeFlags.TypeFactoryProvider, core.ɵNodeFlags.TypeFactoryProvider); + expectToBe( + compilerCore.NodeFlags.TypeUseExistingProvider, core.ɵNodeFlags.TypeUseExistingProvider); + expectToBe(compilerCore.NodeFlags.LazyProvider, core.ɵNodeFlags.LazyProvider); + expectToBe(compilerCore.NodeFlags.PrivateProvider, core.ɵNodeFlags.PrivateProvider); + expectToBe(compilerCore.NodeFlags.TypeDirective, core.ɵNodeFlags.TypeDirective); + expectToBe(compilerCore.NodeFlags.Component, core.ɵNodeFlags.Component); + expectToBe( + compilerCore.NodeFlags.CatProviderNoDirective, core.ɵNodeFlags.CatProviderNoDirective); + expectToBe(compilerCore.NodeFlags.CatProvider, core.ɵNodeFlags.CatProvider); + expectToBe(compilerCore.NodeFlags.OnInit, core.ɵNodeFlags.OnInit); + expectToBe(compilerCore.NodeFlags.OnDestroy, core.ɵNodeFlags.OnDestroy); + expectToBe(compilerCore.NodeFlags.DoCheck, core.ɵNodeFlags.DoCheck); + expectToBe(compilerCore.NodeFlags.OnChanges, core.ɵNodeFlags.OnChanges); + expectToBe(compilerCore.NodeFlags.AfterContentInit, core.ɵNodeFlags.AfterContentInit); + expectToBe(compilerCore.NodeFlags.AfterContentChecked, core.ɵNodeFlags.AfterContentChecked); + expectToBe(compilerCore.NodeFlags.AfterViewInit, core.ɵNodeFlags.AfterViewInit); + expectToBe(compilerCore.NodeFlags.AfterViewChecked, core.ɵNodeFlags.AfterViewChecked); + expectToBe(compilerCore.NodeFlags.EmbeddedViews, core.ɵNodeFlags.EmbeddedViews); + expectToBe(compilerCore.NodeFlags.ComponentView, core.ɵNodeFlags.ComponentView); + expectToBe(compilerCore.NodeFlags.TypeContentQuery, core.ɵNodeFlags.TypeContentQuery); + expectToBe(compilerCore.NodeFlags.TypeViewQuery, core.ɵNodeFlags.TypeViewQuery); + expectToBe(compilerCore.NodeFlags.StaticQuery, core.ɵNodeFlags.StaticQuery); + expectToBe(compilerCore.NodeFlags.DynamicQuery, core.ɵNodeFlags.DynamicQuery); + expectToBe(compilerCore.NodeFlags.CatQuery, core.ɵNodeFlags.CatQuery); + expectToBe(compilerCore.NodeFlags.Types, core.ɵNodeFlags.Types); - expect(compilerCore.InjectFlags.Default).toBe(core.InjectFlags.Default); - expect(compilerCore.InjectFlags.SkipSelf).toBe(core.InjectFlags.SkipSelf); - expect(compilerCore.InjectFlags.Self).toBe(core.InjectFlags.Self); + expectToBe(compilerCore.DepFlags.None, core.ɵDepFlags.None); + expectToBe(compilerCore.DepFlags.SkipSelf, core.ɵDepFlags.SkipSelf); + expectToBe(compilerCore.DepFlags.Optional, core.ɵDepFlags.Optional); + expectToBe(compilerCore.DepFlags.Value, core.ɵDepFlags.Value); - expect(compilerCore.ArgumentType.Inline).toBe(core.ɵArgumentType.Inline); - expect(compilerCore.ArgumentType.Dynamic).toBe(core.ɵArgumentType.Dynamic); + expectToBe(compilerCore.InjectFlags.Default, core.InjectFlags.Default); + expectToBe(compilerCore.InjectFlags.SkipSelf, core.InjectFlags.SkipSelf); + expectToBe(compilerCore.InjectFlags.Self, core.InjectFlags.Self); - expect(compilerCore.BindingFlags.TypeElementAttribute) - .toBe(core.ɵBindingFlags.TypeElementAttribute); - expect(compilerCore.BindingFlags.TypeElementClass).toBe(core.ɵBindingFlags.TypeElementClass); - expect(compilerCore.BindingFlags.TypeElementStyle).toBe(core.ɵBindingFlags.TypeElementStyle); - expect(compilerCore.BindingFlags.TypeProperty).toBe(core.ɵBindingFlags.TypeProperty); - expect(compilerCore.BindingFlags.SyntheticProperty) - .toBe(core.ɵBindingFlags.SyntheticProperty); - expect(compilerCore.BindingFlags.SyntheticHostProperty) - .toBe(core.ɵBindingFlags.SyntheticHostProperty); - expect(compilerCore.BindingFlags.CatSyntheticProperty) - .toBe(core.ɵBindingFlags.CatSyntheticProperty); - expect(compilerCore.BindingFlags.Types).toBe(core.ɵBindingFlags.Types); - expect(compilerCore.QueryBindingType.First).toBe(core.ɵQueryBindingType.First); - expect(compilerCore.QueryBindingType.All).toBe(core.ɵQueryBindingType.All); + expectToBe(compilerCore.ArgumentType.Inline, core.ɵArgumentType.Inline); + expectToBe(compilerCore.ArgumentType.Dynamic, core.ɵArgumentType.Dynamic); - expect(compilerCore.QueryValueType.ElementRef).toBe(core.ɵQueryValueType.ElementRef); - expect(compilerCore.QueryValueType.RenderElement).toBe(core.ɵQueryValueType.RenderElement); - expect(compilerCore.QueryValueType.TemplateRef).toBe(core.ɵQueryValueType.TemplateRef); - expect(compilerCore.QueryValueType.ViewContainerRef) - .toBe(core.ɵQueryValueType.ViewContainerRef); - expect(compilerCore.QueryValueType.Provider).toBe(core.ɵQueryValueType.Provider); + expectToBe( + compilerCore.BindingFlags.TypeElementAttribute, core.ɵBindingFlags.TypeElementAttribute); + expectToBe(compilerCore.BindingFlags.TypeElementClass, core.ɵBindingFlags.TypeElementClass); + expectToBe(compilerCore.BindingFlags.TypeElementStyle, core.ɵBindingFlags.TypeElementStyle); + expectToBe(compilerCore.BindingFlags.TypeProperty, core.ɵBindingFlags.TypeProperty); + expectToBe(compilerCore.BindingFlags.SyntheticProperty, core.ɵBindingFlags.SyntheticProperty); + expectToBe( + compilerCore.BindingFlags.SyntheticHostProperty, + core.ɵBindingFlags.SyntheticHostProperty); + expectToBe( + compilerCore.BindingFlags.CatSyntheticProperty, core.ɵBindingFlags.CatSyntheticProperty); + expectToBe(compilerCore.BindingFlags.Types, core.ɵBindingFlags.Types); - expect(compilerCore.ViewFlags.None).toBe(core.ɵViewFlags.None); - expect(compilerCore.ViewFlags.OnPush).toBe(core.ɵViewFlags.OnPush); + expectToBe(compilerCore.QueryBindingType.First, core.ɵQueryBindingType.First); + expectToBe(compilerCore.QueryBindingType.All, core.ɵQueryBindingType.All); + + expectToBe(compilerCore.QueryValueType.ElementRef, core.ɵQueryValueType.ElementRef); + expectToBe(compilerCore.QueryValueType.RenderElement, core.ɵQueryValueType.RenderElement); + expectToBe(compilerCore.QueryValueType.TemplateRef, core.ɵQueryValueType.TemplateRef); + expectToBe( + compilerCore.QueryValueType.ViewContainerRef, core.ɵQueryValueType.ViewContainerRef); + expectToBe(compilerCore.QueryValueType.Provider, core.ɵQueryValueType.Provider); + + expectToBe(compilerCore.ViewFlags.None, core.ɵViewFlags.None); + expectToBe(compilerCore.ViewFlags.OnPush, core.ɵViewFlags.OnPush); }); }); } diff --git a/packages/compiler/test/css_parser/css_lexer_spec.ts b/packages/compiler/test/css_parser/css_lexer_spec.ts index a5551fc195..64a44d6c64 100644 --- a/packages/compiler/test/css_parser/css_lexer_spec.ts +++ b/packages/compiler/test/css_parser/css_lexer_spec.ts @@ -274,7 +274,7 @@ import {CssLexer, CssLexerMode, CssToken, CssTokenType, cssScannerError, getRawM it('should throw an error if a selector is being parsed while in the wrong mode', () => { const cssCode = '.class > tag'; - let capturedMessage: string = undefined !; + let capturedMessage: string|null = null; try { tokenize(cssCode, false, CssLexerMode.STYLE_BLOCK); } catch (e) { @@ -282,8 +282,8 @@ import {CssLexer, CssLexerMode, CssToken, CssTokenType, cssScannerError, getRawM } expect(capturedMessage).toMatch(/Unexpected character \[\>\] at column 0:7 in expression/g); - capturedMessage = null !; + capturedMessage = null; try { tokenize(cssCode, false, CssLexerMode.SELECTOR); } catch (e) { diff --git a/packages/compiler/test/css_parser/css_visitor_spec.ts b/packages/compiler/test/css_parser/css_visitor_spec.ts index 7f617ab053..5a36459264 100644 --- a/packages/compiler/test/css_parser/css_visitor_spec.ts +++ b/packages/compiler/test/css_parser/css_visitor_spec.ts @@ -170,21 +170,22 @@ function _getCaptureAst(capture: any[], index = 0): CssAst { expect(captures.length).toEqual(3); const rule1 = _getCaptureAst(captures, 0); - expect(rule1).toEqual(ast.rules[0]); + expect(rule1).toEqual(ast.rules[0] as CssSelectorRuleAst); const firstSelector = rule1.selectors[0]; const firstSimpleSelector = firstSelector.selectorParts[0]; _assertTokens(firstSimpleSelector.tokens, ['.', 'rule1']); const rule2 = _getCaptureAst(captures, 1); - expect(rule2).toEqual(ast.rules[1]); + expect(rule2).toEqual(ast.rules[1] as CssSelectorRuleAst); const secondSelector = rule2.selectors[0]; const secondSimpleSelector = secondSelector.selectorParts[0]; _assertTokens(secondSimpleSelector.tokens, ['.', 'rule2']); const rule3 = _getCaptureAst(captures, 2); - expect(rule3).toEqual((ast.rules[2]).block.entries[0]); + expect(rule3).toEqual( + (ast.rules[2] as CssSelectorRuleAst).block.entries[0] as CssSelectorRuleAst); const thirdSelector = rule3.selectors[0]; const thirdSimpleSelector = thirdSelector.selectorParts[0]; diff --git a/packages/compiler/test/i18n/extractor_merger_spec.ts b/packages/compiler/test/i18n/extractor_merger_spec.ts index 5b1a05b8c0..55f8c45225 100644 --- a/packages/compiler/test/i18n/extractor_merger_spec.ts +++ b/packages/compiler/test/i18n/extractor_merger_spec.ts @@ -547,7 +547,7 @@ function fakeNoTranslate( function extract( html: string, implicitTags: string[] = [], - implicitAttrs: {[k: string]: string[]} = {}): [string[], string, string][] { + implicitAttrs: {[k: string]: string[]} = {}): [string[], string, string, string][] { const result = extractMessages(parseHtml(html), DEFAULT_INTERPOLATION_CONFIG, implicitTags, implicitAttrs); @@ -558,7 +558,7 @@ function extract( // clang-format off // https://github.com/angular/clang-format/issues/35 return result.messages.map( - message => [serializeI18nNodes(message.nodes), message.meaning, message.description, message.id]) as [string[], string, string][]; + message => [serializeI18nNodes(message.nodes), message.meaning, message.description, message.id]) as [string[], string, string, string][]; // clang-format on } diff --git a/packages/compiler/test/output/abstract_emitter_node_only_spec.ts b/packages/compiler/test/output/abstract_emitter_node_only_spec.ts index affabdad26..d70410d491 100644 --- a/packages/compiler/test/output/abstract_emitter_node_only_spec.ts +++ b/packages/compiler/test/output/abstract_emitter_node_only_spec.ts @@ -116,9 +116,10 @@ function expectMap( const sm = ctx.toSourceMapGenerator('o.ts').toJSON() !; const genPosition = {line: genLine + 1, column: genCol}; const origPosition = originalPositionFor(sm, genPosition); - expect(origPosition.source).toEqual(source); - expect(origPosition.line).toEqual(srcLine === null ? null : srcLine + 1); - expect(origPosition.column).toEqual(srcCol); + // TODO: Review use of `any` here (#19904) + expect(origPosition.source as any).toEqual(source); + expect(origPosition.line as any).toEqual(srcLine === null ? null : srcLine + 1); + expect(origPosition.column as any).toEqual(srcCol); } // returns the number of segments per line diff --git a/packages/compiler/testing/src/output/source_map_util.ts b/packages/compiler/testing/src/output/source_map_util.ts index 24abecbb2a..6280d0393a 100644 --- a/packages/compiler/testing/src/output/source_map_util.ts +++ b/packages/compiler/testing/src/output/source_map_util.ts @@ -36,4 +36,4 @@ export function extractSourceMap(source: string): SourceMap|null { function decodeB64String(s: string): string { return b64.toByteArray(s).reduce((s: string, c: number) => s + String.fromCharCode(c), ''); -} \ No newline at end of file +} diff --git a/packages/core/test/linker/source_map_integration_node_only_spec.ts b/packages/core/test/linker/source_map_integration_node_only_spec.ts index acacc11bca..e4dbf091d4 100644 --- a/packages/core/test/linker/source_map_integration_node_only_spec.ts +++ b/packages/core/test/linker/source_map_integration_node_only_spec.ts @@ -20,7 +20,13 @@ import {ComponentFixture, TestBed, fakeAsync, tick} from '@angular/core/testing' let resourceLoader: MockResourceLoader; beforeEach(() => { + // Jasmine relies on methods on `Function.prototype`, so restore the prototype on the spy. + // Work around for: https://github.com/jasmine/jasmine/issues/1573 + // TODO: Figure out a better way to retrieve the JIT sources, without spying on `Function`. + const originalProto = ɵglobal.Function.prototype; jitSpy = spyOn(ɵglobal, 'Function').and.callThrough(); + ɵglobal.Function.prototype = originalProto; + resourceLoader = new MockResourceLoader(); TestBed.configureCompiler({providers: [{provide: ResourceLoader, useValue: resourceLoader}]}); }); diff --git a/packages/core/test/linker/system_ng_module_factory_loader_spec.ts b/packages/core/test/linker/system_ng_module_factory_loader_spec.ts index d29f013436..fbbaa0f591 100644 --- a/packages/core/test/linker/system_ng_module_factory_loader_spec.ts +++ b/packages/core/test/linker/system_ng_module_factory_loader_spec.ts @@ -35,12 +35,13 @@ function mockSystem(modules: {[module: string]: any}) { it('loads a default factory by appending the factory suffix', async(() => { const loader = new SystemJsNgModuleLoader(new Compiler()); - loader.load('test').then(contents => { expect(contents).toBe('test module factory'); }); + loader.load('test').then( + contents => { expect(contents).toBe('test module factory' as any); }); })); it('loads a named factory by appending the factory suffix', async(() => { const loader = new SystemJsNgModuleLoader(new Compiler()); loader.load('test#Named').then(contents => { - expect(contents).toBe('test NamedNgFactory'); + expect(contents).toBe('test NamedNgFactory' as any); }); })); it('loads a named factory with a configured prefix and suffix', async(() => { @@ -49,7 +50,7 @@ function mockSystem(modules: {[module: string]: any}) { factoryPathSuffix: '/suffixed', }); loader.load('test#Named').then(contents => { - expect(contents).toBe('test module factory'); + expect(contents).toBe('test module factory' as any); }); })); }); diff --git a/packages/core/test/reflection/reflector_spec.ts b/packages/core/test/reflection/reflector_spec.ts index a5f022cb24..d24ff79e92 100644 --- a/packages/core/test/reflection/reflector_spec.ts +++ b/packages/core/test/reflection/reflector_spec.ts @@ -315,7 +315,7 @@ class TestObj { // But we should still get an array of the right length based on function.length. expect(reflector.parameters(ChildWithCtorNoDecorator)).toEqual([ undefined, undefined, undefined - ]); + ] as any[]); // TODO: Review use of `any` here (#19904) expect(reflector.parameters(NoDecorators)).toEqual([]); expect(reflector.parameters({})).toEqual([]); diff --git a/packages/core/test/render3/di_spec.ts b/packages/core/test/render3/di_spec.ts index 2db6233f48..540e34dbe4 100644 --- a/packages/core/test/render3/di_spec.ts +++ b/packages/core/test/render3/di_spec.ts @@ -1203,8 +1203,8 @@ describe('di', () => { describe('@Attribute', () => { it('should inject attribute', () => { - let exist: string|undefined = 'wrong'; - let nonExist: string|undefined = 'wrong'; + let exist = 'wrong' as string | undefined; + let nonExist = 'wrong' as string | undefined; const MyApp = createComponent('my-app', function(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { @@ -1221,8 +1221,8 @@ describe('di', () => { // https://stackblitz.com/edit/angular-8ytqkp?file=src%2Fapp%2Fapp.component.ts it('should not inject attributes representing bindings and outputs', () => { - let exist: string|undefined = 'wrong'; - let nonExist: string|undefined = 'wrong'; + let exist = 'wrong' as string | undefined; + let nonExist = 'wrong' as string | undefined; const MyApp = createComponent('my-app', function(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { @@ -1238,8 +1238,8 @@ describe('di', () => { }); it('should not accidentally inject attributes representing bindings and outputs', () => { - let exist: string|undefined = 'wrong'; - let nonExist: string|undefined = 'wrong'; + let exist = 'wrong' as string | undefined; + let nonExist = 'wrong' as string | undefined; const MyApp = createComponent('my-app', function(rf: RenderFlags, ctx: any) { if (rf & RenderFlags.Create) { @@ -1415,7 +1415,7 @@ describe('di', () => { // so that we have smaller HelloWorld. (parent.tNode as{parent: any}).parent = undefined; - const injector = getOrCreateNodeInjector(); + const injector: any = getOrCreateNodeInjector(); // TODO: Review use of `any` here (#19904) expect(injector).not.toBe(null); } finally { leaveView(oldView); diff --git a/packages/core/test/render3/ng_on_changes_feature_spec.ts b/packages/core/test/render3/ng_on_changes_feature_spec.ts index 719a5dde5b..6ec86072c6 100644 --- a/packages/core/test/render3/ng_on_changes_feature_spec.ts +++ b/packages/core/test/render3/ng_on_changes_feature_spec.ts @@ -259,7 +259,7 @@ describe('NgOnChangesFeature', () => { it('correctly computes firstChange', () => { class MyDirective implements OnChanges { - public log: Array = []; + public log: Array = []; public valA: string = 'initValue'; // TODO(issue/24571): remove '!'. public valB !: string; diff --git a/packages/core/test/render3/properties_spec.ts b/packages/core/test/render3/properties_spec.ts index e586dd49d7..36e9cc2ab3 100644 --- a/packages/core/test/render3/properties_spec.ts +++ b/packages/core/test/render3/properties_spec.ts @@ -112,7 +112,7 @@ describe('elementProperty', () => { class OtherDir { // TODO(issue/24571): remove '!'. - id !: boolean; + id !: number; clickStream = new EventEmitter(); static ngDirectiveDef = defineDirective({ @@ -138,7 +138,7 @@ describe('elementProperty', () => { class IdDir { // TODO(issue/24571): remove '!'. - idNumber !: number; + idNumber !: string; static ngDirectiveDef = defineDirective({ type: IdDir, @@ -347,15 +347,14 @@ describe('elementProperty', () => { } } - expect(renderToHtml(Template, {condition: true, id1: 'one', id2: 'two', id3: 'three'}, deps)) + expect(renderToHtml(Template, {condition: true, id1: 'one', id2: 'two', id3: 3}, deps)) .toEqual(``); expect(idDir !.idNumber).toEqual('one'); - expect( - renderToHtml(Template, {condition: false, id1: 'four', id2: 'two', id3: 'three'}, deps)) + expect(renderToHtml(Template, {condition: false, id1: 'four', id2: 'two', id3: 3}, deps)) .toEqual(``); expect(idDir !.idNumber).toEqual('four'); - expect(otherDir !.id).toEqual('three'); + expect(otherDir !.id).toEqual(3); }); }); diff --git a/packages/core/test/render3/pure_function_spec.ts b/packages/core/test/render3/pure_function_spec.ts index 32d31f1f68..6dfe18f79a 100644 --- a/packages/core/test/render3/pure_function_spec.ts +++ b/packages/core/test/render3/pure_function_spec.ts @@ -293,11 +293,11 @@ describe('array literals', () => { const e0_ff = (v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any, v8: any) => ['start', v0, v1, v2, v3, v4, v5, v6, v7, v8, 'end']; - const e0_ff_1 = (v: any) => { return {name: v}; }; + const e0_ff_1 = (v: any) => `modified_${v}`; renderToHtml(Template, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'], directives); /** - * + * * */ function Template(rf: RenderFlags, c: any) { @@ -315,17 +315,17 @@ describe('array literals', () => { } expect(myComp !.names).toEqual([ - 'start', 'a', 'b', 'c', 'd', {name: 'e'}, 'f', 'g', 'h', 'i', 'end' + 'start', 'a', 'b', 'c', 'd', 'modified_e', 'f', 'g', 'h', 'i', 'end' ]); renderToHtml(Template, ['a1', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'], directives); expect(myComp !.names).toEqual([ - 'start', 'a1', 'b', 'c', 'd', {name: 'e'}, 'f', 'g', 'h', 'i', 'end' + 'start', 'a1', 'b', 'c', 'd', 'modified_e', 'f', 'g', 'h', 'i', 'end' ]); renderToHtml(Template, ['a1', 'b', 'c', 'd', 'e5', 'f', 'g', 'h', 'i'], directives); expect(myComp !.names).toEqual([ - 'start', 'a1', 'b', 'c', 'd', {name: 'e5'}, 'f', 'g', 'h', 'i', 'end' + 'start', 'a1', 'b', 'c', 'd', 'modified_e5', 'f', 'g', 'h', 'i', 'end' ]); }); diff --git a/packages/core/test/view/component_view_spec.ts b/packages/core/test/view/component_view_spec.ts index 04b30d681d..2c5aa1a0e1 100644 --- a/packages/core/test/view/component_view_spec.ts +++ b/packages/core/test/view/component_view_spec.ts @@ -18,7 +18,7 @@ import {callMostRecentEventListenerHandler, compViewDef, createAndGetRootNodes, * We map addEventListener to the Zones internal name. This is because we want to be fast * and bypass the zone bookkeeping. We know that we can do the bookkeeping faster. */ -const addEventListener = '__zone_symbol__addEventListener'; +const addEventListener = '__zone_symbol__addEventListener' as 'addEventListener'; { describe(`Component Views`, () => { diff --git a/packages/core/test/view/element_spec.ts b/packages/core/test/view/element_spec.ts index 43d111a09e..5e9fe24afd 100644 --- a/packages/core/test/view/element_spec.ts +++ b/packages/core/test/view/element_spec.ts @@ -20,8 +20,8 @@ import {ARG_TYPE_VALUES, callMostRecentEventListenerHandler, checkNodeInlineOrDy * We map addEventListener to the Zones internal name. This is because we want to be fast * and bypass the zone bookkeeping. We know that we can do the bookkeeping faster. */ -const addEventListener = '__zone_symbol__addEventListener'; -const removeEventListener = '__zone_symbol__removeEventListener'; +const addEventListener = '__zone_symbol__addEventListener' as 'addEventListener'; +const removeEventListener = '__zone_symbol__removeEventListener' as 'removeEventListener'; { describe(`View Elements`, () => { diff --git a/packages/core/testing/src/testing_internal.ts b/packages/core/testing/src/testing_internal.ts index 4caa21aeae..a83111fd40 100644 --- a/packages/core/testing/src/testing_internal.ts +++ b/packages/core/testing/src/testing_internal.ts @@ -23,7 +23,7 @@ export const proxy: ClassDecorator = (t: any) => t; const _global = (typeof window === 'undefined' ? global : window); export const afterEach: Function = _global.afterEach; -export const expect: (actual: any) => jasmine.Matchers = _global.expect; +export const expect: (actual: T) => jasmine.Matchers = _global.expect; const jsmBeforeEach = _global.beforeEach; const jsmDescribe = _global.describe; diff --git a/packages/examples/core/testability/ts/whenStable/e2e_test/testability_example_spec.ts b/packages/examples/core/testability/ts/whenStable/e2e_test/testability_example_spec.ts index 94eaaca00f..83a28698a2 100644 --- a/packages/examples/core/testability/ts/whenStable/e2e_test/testability_example_spec.ts +++ b/packages/examples/core/testability/ts/whenStable/e2e_test/testability_example_spec.ts @@ -15,7 +15,7 @@ describe('testability example', () => { describe('using task tracking', () => { const URL = '/core/testability/ts/whenStable/'; - it('times out with a list of tasks', (done) => { + it('times out with a list of tasks', (done: DoneFn) => { browser.get(URL); browser.ignoreSynchronization = true; diff --git a/packages/examples/tsconfig-build.json b/packages/examples/tsconfig-build.json index 5b95650c02..ac40446b1c 100644 --- a/packages/examples/tsconfig-build.json +++ b/packages/examples/tsconfig-build.json @@ -11,13 +11,13 @@ "rxjs/*": ["../../node_modules/rxjs/*"] }, "outDir": "../../dist/examples", - "types": ["jasmine", "node", "angular", "systemjs"] + "types": ["angular"] }, "include": [ - "./**/*.ts", - "../../node_modules/zone.js/dist/zone.js.d.ts", - // TODO(i): we can't use protractor's built-in typings because they contain lots of ambient definitions - "../../node_modules/@types/protractor/index.d.ts" + "../../node_modules/@types/jasminewd2/index.d.ts", + "../../tools/types-ext/jasminewd2.d.ts", + "../types.d.ts", + "**/*.ts" ] } diff --git a/packages/examples/tsconfig.json b/packages/examples/tsconfig.json new file mode 100644 index 0000000000..aa43ab7164 --- /dev/null +++ b/packages/examples/tsconfig.json @@ -0,0 +1,19 @@ +// WARNING: +// This file is used to build the e2e tests only. +// The rest of the files are included in `/packages/tsconfig.json`. +{ + "extends": "../tsconfig.json", + + "compilerOptions": { + "types": [] + }, + + "include": [ + "../../node_modules/@types/jasminewd2/index.d.ts", + "../../tools/types-ext/jasminewd2.d.ts", + "../types.d.ts", + "**/e2e_test/*" + ], + + "exclude": [] +} diff --git a/packages/examples/upgrade/static/ts/full/e2e_test/static_full_spec.ts b/packages/examples/upgrade/static/ts/full/e2e_test/static_full_spec.ts index 5558ffb5b4..d941609740 100644 --- a/packages/examples/upgrade/static/ts/full/e2e_test/static_full_spec.ts +++ b/packages/examples/upgrade/static/ts/full/e2e_test/static_full_spec.ts @@ -50,4 +50,4 @@ describe('upgrade/static (full)', () => { firstHero = element.all(by.css('ng1-hero')).get(0); expect(firstHero.element(by.css('h2')).getText()).toEqual('Wonder Woman'); }); -}); \ No newline at end of file +}); diff --git a/packages/examples/upgrade/static/ts/lite/e2e_test/e2e_util.ts b/packages/examples/upgrade/static/ts/lite/e2e_test/e2e_util.ts index bc53502d01..c429b50000 100644 --- a/packages/examples/upgrade/static/ts/lite/e2e_test/e2e_util.ts +++ b/packages/examples/upgrade/static/ts/lite/e2e_test/e2e_util.ts @@ -10,7 +10,7 @@ import {ElementFinder, by} from 'protractor'; declare global { namespace jasmine { - interface Matchers { + interface Matchers { toBeAHero(): Promise; toHaveName(exectedName: string): Promise; } diff --git a/packages/forms/test/directives_spec.ts b/packages/forms/test/directives_spec.ts index 5964b53e0f..0876818c2a 100644 --- a/packages/forms/test/directives_spec.ts +++ b/packages/forms/test/directives_spec.ts @@ -92,14 +92,14 @@ function asyncValidator(expected: any, timeout = 0) { }); it('should return custom accessor when provided', () => { - const customAccessor = new SpyValueAccessor(); + const customAccessor: ControlValueAccessor = new SpyValueAccessor() as any; const checkboxAccessor = new CheckboxControlValueAccessor(null !, null !); expect(selectValueAccessor(dir, [defaultAccessor, customAccessor, checkboxAccessor])) .toEqual(customAccessor); }); it('should return custom accessor when provided with select multiple', () => { - const customAccessor = new SpyValueAccessor(); + const customAccessor: ControlValueAccessor = new SpyValueAccessor() as any; const selectMultipleAccessor = new SelectMultipleControlValueAccessor(null !, null !); expect(selectValueAccessor( dir, [defaultAccessor, customAccessor, selectMultipleAccessor])) diff --git a/packages/forms/test/reactive_integration_spec.ts b/packages/forms/test/reactive_integration_spec.ts index 2068970d86..0e2a9cb32a 100644 --- a/packages/forms/test/reactive_integration_spec.ts +++ b/packages/forms/test/reactive_integration_spec.ts @@ -207,7 +207,7 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec'; fixture.detectChanges(); emailInput = fixture.debugElement.query(By.css('[formControlName="email"]')); - expect(emailInput).toBe(null); + expect(emailInput as any).toBe(null); // TODO: Review use of `any` here (#19904) }); it('should strip array controls that are not found', () => { @@ -1393,7 +1393,7 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec'; fixture.componentInstance.form = formGroup; fixture.detectChanges(); - const values: string[] = []; + const values: any[] = []; const streams = merge( control.valueChanges, control.statusChanges, formGroup.valueChanges, formGroup.statusChanges); @@ -1430,7 +1430,7 @@ import {MyInput, MyInputForm} from './value_accessor_integration_spec'; fixture.componentInstance.form = formGroup; fixture.detectChanges(); - const values: string[] = []; + const values: (string | {[key: string]: string})[] = []; const streams = merge( control.valueChanges, control.statusChanges, formGroup.valueChanges, formGroup.statusChanges); diff --git a/packages/forms/test/template_integration_spec.ts b/packages/forms/test/template_integration_spec.ts index 8782a89966..c2caf9a067 100644 --- a/packages/forms/test/template_integration_spec.ts +++ b/packages/forms/test/template_integration_spec.ts @@ -460,7 +460,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat fixture.detectChanges(); tick(); - const values: string[] = []; + const values: any[] = []; const form = fixture.debugElement.children[0].injector.get(NgForm); const sub = merge(form.valueChanges !, form.statusChanges !) @@ -748,7 +748,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat it('should reset properly', fakeAsync(() => { const fixture = initTest(NgModelForm); - fixture.componentInstance.name = 'Nancy'; + fixture.componentInstance.name = 'Nancy' as string | null; fixture.componentInstance.options = {updateOn: 'submit'}; fixture.detectChanges(); tick(); @@ -792,7 +792,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat fixture.detectChanges(); tick(); - const values: string[] = []; + const values: any[] = []; const form = fixture.debugElement.children[0].injector.get(NgForm); const sub = merge(form.valueChanges !, form.statusChanges !) @@ -1028,7 +1028,7 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat it('should reset the form to empty when reset event is fired', fakeAsync(() => { const fixture = initTest(NgModelForm); - fixture.componentInstance.name = 'should be cleared'; + fixture.componentInstance.name = 'should be cleared' as string | null; fixture.detectChanges(); tick(); @@ -1654,7 +1654,7 @@ class StandaloneNgModel { }) class NgModelForm { // TODO(issue/24571): remove '!'. - name !: string; + name !: string | null; // TODO(issue/24571): remove '!'. event !: Event; options = {}; diff --git a/packages/forms/test/value_accessor_integration_spec.ts b/packages/forms/test/value_accessor_integration_spec.ts index 609592b09e..3a9c8317cd 100644 --- a/packages/forms/test/value_accessor_integration_spec.ts +++ b/packages/forms/test/value_accessor_integration_spec.ts @@ -327,7 +327,7 @@ import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util' const fixture = initTest(NgModelSelectWithNullForm); const comp = fixture.componentInstance; comp.cities = [{'name': 'SF'}, {'name': 'NYC'}]; - comp.selectedCity = null !; + comp.selectedCity = null; fixture.detectChanges(); const select = fixture.debugElement.query(By.css('select')); @@ -336,7 +336,7 @@ import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util' dispatchEvent(select.nativeElement, 'change'); fixture.detectChanges(); tick(); - expect(comp.selectedCity['name']).toEqual('NYC'); + expect(comp.selectedCity !['name']).toEqual('NYC'); select.nativeElement.value = '0: null'; dispatchEvent(select.nativeElement, 'change'); @@ -1231,7 +1231,7 @@ class NgModelSelectForm { ` }) class NgModelSelectWithNullForm { - selectedCity: {[k: string]: string} = {}; + selectedCity: {[k: string]: string}|null = {}; cities: any[] = []; } diff --git a/packages/platform-browser/test/browser/transfer_state_spec.ts b/packages/platform-browser/test/browser/transfer_state_spec.ts index d3418c518d..d7dae0b4ec 100644 --- a/packages/platform-browser/test/browser/transfer_state_spec.ts +++ b/packages/platform-browser/test/browser/transfer_state_spec.ts @@ -80,14 +80,14 @@ import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens'; it('supports setting and accessing value \'false\' via get', () => { const transferState: TransferState = TestBed.get(TransferState); transferState.set(TEST_KEY, false); - expect(transferState.get(TEST_KEY, 20)).toBe(false); + expect(transferState.get(TEST_KEY, true)).toBe(false); expect(transferState.hasKey(TEST_KEY)).toBe(true); }); it('supports setting and accessing value \'null\' via get', () => { const transferState: TransferState = TestBed.get(TransferState); transferState.set(TEST_KEY, null); - expect(transferState.get(TEST_KEY, 20)).toBe(null); + expect(transferState.get(TEST_KEY, 20 as any)).toBe(null); expect(transferState.hasKey(TEST_KEY)).toBe(true); }); @@ -130,4 +130,4 @@ import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens'; expect(unescapedObj['testString']).toBe(testString); }); }); -})(); \ No newline at end of file +})(); diff --git a/packages/platform-browser/test/testing_public_spec.ts b/packages/platform-browser/test/testing_public_spec.ts index c02f739f5e..d2f4031904 100644 --- a/packages/platform-browser/test/testing_public_spec.ts +++ b/packages/platform-browser/test/testing_public_spec.ts @@ -809,7 +809,7 @@ class CompWithUrlTemplate { describe('errors', () => { let originalJasmineIt: (description: string, func: () => void) => jasmine.Spec; - let originalJasmineBeforeEach: (beforeEachFunction: () => void) => void; + let originalJasmineBeforeEach: (beforeEachFunction: (done: DoneFn) => void) => void; const patchJasmineIt = () => { let resolve: (result: any) => void; diff --git a/packages/platform-browser/testing/src/matchers.ts b/packages/platform-browser/testing/src/matchers.ts index 45c51c53e4..cc1aae1bf3 100644 --- a/packages/platform-browser/testing/src/matchers.ts +++ b/packages/platform-browser/testing/src/matchers.ts @@ -15,7 +15,7 @@ import {ɵgetDOM as getDOM} from '@angular/platform-browser'; /** * Jasmine matchers that check Angular specific conditions. */ -export interface NgMatchers extends jasmine.Matchers { +export interface NgMatchers extends jasmine.Matchers { /** * Expect the value to be a `Promise`. * diff --git a/packages/router/src/url_tree.ts b/packages/router/src/url_tree.ts index 3ba437ff68..958c3f32cb 100644 --- a/packages/router/src/url_tree.ts +++ b/packages/router/src/url_tree.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {PRIMARY_OUTLET, ParamMap, convertToParamMap} from './shared'; +import {PRIMARY_OUTLET, ParamMap, Params, convertToParamMap} from './shared'; import {forEach, shallowEqual} from './utils/collection'; export function createEmptyUrlTree() { @@ -23,8 +23,8 @@ export function containsTree(container: UrlTree, containee: UrlTree, exact: bool containsSegmentGroup(container.root, containee.root); } -function equalQueryParams( - container: {[k: string]: string}, containee: {[k: string]: string}): boolean { +function equalQueryParams(container: Params, containee: Params): boolean { + // TODO: This does not handle array params correctly. return shallowEqual(container, containee); } @@ -38,8 +38,8 @@ function equalSegmentGroups(container: UrlSegmentGroup, containee: UrlSegmentGro return true; } -function containsQueryParams( - container: {[k: string]: string}, containee: {[k: string]: string}): boolean { +function containsQueryParams(container: Params, containee: Params): boolean { + // TODO: This does not handle array params correctly. return Object.keys(containee).length <= Object.keys(container).length && Object.keys(containee).every(key => containee[key] === container[key]); } @@ -112,7 +112,7 @@ export class UrlTree { /** The root segment group of the URL tree */ public root: UrlSegmentGroup, /** The query params of the URL */ - public queryParams: {[key: string]: string}, + public queryParams: Params, /** The fragment of the URL */ public fragment: string|null) {} @@ -446,8 +446,8 @@ class UrlParser { return new UrlSegmentGroup([], this.parseChildren()); } - parseQueryParams(): {[key: string]: any} { - const params: {[key: string]: any} = {}; + parseQueryParams(): Params { + const params: Params = {}; if (this.consumeOptional('?')) { do { this.parseQueryParam(params); @@ -534,7 +534,7 @@ class UrlParser { } // Parse a single query parameter `name[=value]` - private parseQueryParam(params: {[key: string]: any}): void { + private parseQueryParam(params: Params): void { const key = matchQueryParams(this.remaining); if (!key) { return; diff --git a/packages/router/test/bootstrap.spec.ts b/packages/router/test/bootstrap.spec.ts index adf4c99e0c..634990a749 100644 --- a/packages/router/test/bootstrap.spec.ts +++ b/packages/router/test/bootstrap.spec.ts @@ -210,7 +210,7 @@ describe('bootstrap', () => { platformBrowserDynamic([]).bootstrapModule(TestModule).then(res => { const router = res.injector.get(Router); - spyOn(router, 'resetRootComponentType').and.callThrough(); + spyOn(router as any, 'resetRootComponentType').and.callThrough(); const appRef: ApplicationRef = res.injector.get(ApplicationRef); appRef.bootstrap(SecondRootCmp); @@ -236,7 +236,7 @@ describe('bootstrap', () => { platformBrowserDynamic([]).bootstrapModule(TestModule).then(res => { const router = res.injector.get(Router); - spyOn(router, 'resetRootComponentType').and.callThrough(); + spyOn(router as any, 'resetRootComponentType').and.callThrough(); const appRef: ApplicationRef = res.injector.get(ApplicationRef); appRef.components[0].onDestroy(() => { diff --git a/packages/router/test/create_router_state.spec.ts b/packages/router/test/create_router_state.spec.ts index d69c2cc6e6..0a0c2889c5 100644 --- a/packages/router/test/create_router_state.spec.ts +++ b/packages/router/test/create_router_state.spec.ts @@ -131,7 +131,7 @@ function checkActivatedRoute( if (actual === null) { expect(actual).toBeDefined(); } else { - expect(actual.component).toBe(cmp); + expect(actual.component as any).toBe(cmp); expect(actual.outlet).toEqual(outlet); } } diff --git a/packages/router/test/recognize.spec.ts b/packages/router/test/recognize.spec.ts index 1db36a1cd1..b2537d13c6 100644 --- a/packages/router/test/recognize.spec.ts +++ b/packages/router/test/recognize.spec.ts @@ -799,7 +799,7 @@ function checkActivatedRoute( } else { expect(actual.url.map(s => s.path).join('/')).toEqual(url); expect(actual.params).toEqual(params); - expect(actual.component).toBe(cmp); + expect(actual.component as any).toBe(cmp); expect(actual.outlet).toEqual(outlet); } } diff --git a/packages/router/test/router.spec.ts b/packages/router/test/router.spec.ts index 66b606d740..df6d5d0a80 100644 --- a/packages/router/test/router.spec.ts +++ b/packages/router/test/router.spec.ts @@ -9,12 +9,12 @@ import {Location} from '@angular/common'; import {TestBed, inject} from '@angular/core/testing'; -import {ResolveData} from '../src/config'; +import {Routes} from '../src/config'; import {ChildActivationStart} from '../src/events'; import {PreActivation} from '../src/pre_activation'; import {Router} from '../src/router'; import {ChildrenOutletContexts} from '../src/router_outlet_context'; -import {ActivatedRouteSnapshot, RouterStateSnapshot, createEmptyStateSnapshot} from '../src/router_state'; +import {RouterStateSnapshot, createEmptyStateSnapshot} from '../src/router_state'; import {DefaultUrlSerializer} from '../src/url_tree'; import {TreeNode} from '../src/utils/tree'; import {RouterTestingModule} from '../testing/src/router_testing_module'; @@ -30,14 +30,17 @@ describe('Router', () => { it('should copy config to avoid mutations of user-provided objects', () => { const r: Router = TestBed.get(Router); - const configs = [{ + const configs: Routes = [{ path: 'a', component: TestComponent, children: [{path: 'b', component: TestComponent}, {path: 'c', component: TestComponent}] }]; + const children = configs[0].children !; + r.resetConfig(configs); - let rConfigs = r.config; + const rConfigs = r.config; + const rChildren = rConfigs[0].children !; // routes array and shallow copy expect(configs).not.toBe(rConfigs); @@ -46,11 +49,11 @@ describe('Router', () => { expect(configs[0].component).toBe(rConfigs[0].component); // children should be new array and routes shallow copied - expect(configs[0].children).not.toBe(rConfigs[0].children); - expect(configs[0].children[0]).not.toBe(rConfigs[0].children ![0]); - expect(configs[0].children[0].path).toBe(rConfigs[0].children ![0].path); - expect(configs[0].children[1]).not.toBe(rConfigs[0].children ![1]); - expect(configs[0].children[1].path).toBe(rConfigs[0].children ![1].path); + expect(children).not.toBe(rChildren); + expect(children[0]).not.toBe(rChildren[0]); + expect(children[0].path).toBe(rChildren[0].path); + expect(children[1]).not.toBe(rChildren[1]); + expect(children[1].path).toBe(rChildren[1].path); }); }); diff --git a/packages/router/test/router_state.spec.ts b/packages/router/test/router_state.spec.ts index e964399af9..369d4ca26c 100644 --- a/packages/router/test/router_state.spec.ts +++ b/packages/router/test/router_state.spec.ts @@ -125,41 +125,41 @@ describe('RouterState & Snapshot', () => { } it('should return false when params are different', () => { - expect(equalParamsAndUrlSegments(createSnapshot({a: 1}, []), createSnapshot({a: 2}, []))) + expect(equalParamsAndUrlSegments(createSnapshot({a: '1'}, []), createSnapshot({a: '2'}, []))) .toEqual(false); }); it('should return false when urls are different', () => { expect(equalParamsAndUrlSegments( - createSnapshot({a: 1}, [new UrlSegment('a', {})]), - createSnapshot({a: 1}, [new UrlSegment('b', {})]))) + createSnapshot({a: '1'}, [new UrlSegment('a', {})]), + createSnapshot({a: '1'}, [new UrlSegment('b', {})]))) .toEqual(false); }); it('should return true othewise', () => { expect(equalParamsAndUrlSegments( - createSnapshot({a: 1}, [new UrlSegment('a', {})]), - createSnapshot({a: 1}, [new UrlSegment('a', {})]))) + createSnapshot({a: '1'}, [new UrlSegment('a', {})]), + createSnapshot({a: '1'}, [new UrlSegment('a', {})]))) .toEqual(true); }); it('should return false when upstream params are different', () => { const [snapshot1, snapshot2] = - createSnapshotPairWithParent([{a: 1}, {a: 1}], [{b: 1}, {c: 1}], ['a', 'a']); + createSnapshotPairWithParent([{a: '1'}, {a: '1'}], [{b: '1'}, {c: '1'}], ['a', 'a']); expect(equalParamsAndUrlSegments(snapshot1, snapshot2)).toEqual(false); }); it('should return false when upstream urls are different', () => { const [snapshot1, snapshot2] = - createSnapshotPairWithParent([{a: 1}, {a: 1}], [{b: 1}, {b: 1}], ['a', 'b']); + createSnapshotPairWithParent([{a: '1'}, {a: '1'}], [{b: '1'}, {b: '1'}], ['a', 'b']); expect(equalParamsAndUrlSegments(snapshot1, snapshot2)).toEqual(false); }); it('should return true when upstream urls and params are equal', () => { const [snapshot1, snapshot2] = - createSnapshotPairWithParent([{a: 1}, {a: 1}], [{b: 1}, {b: 1}], ['a', 'a']); + createSnapshotPairWithParent([{a: '1'}, {a: '1'}], [{b: '1'}, {b: '1'}], ['a', 'a']); expect(equalParamsAndUrlSegments(snapshot1, snapshot2)).toEqual(true); }); @@ -184,8 +184,8 @@ describe('RouterState & Snapshot', () => { } it('should call change observers', () => { - const firstPlace = createSnapshot({a: 1}, []); - const secondPlace = createSnapshot({a: 2}, []); + const firstPlace = createSnapshot({a: '1'}, []); + const secondPlace = createSnapshot({a: '2'}, []); route.snapshot = firstPlace; (route as any)._futureSnapshot = secondPlace; diff --git a/packages/router/test/spy_ng_module_factory_loader.spec.ts b/packages/router/test/spy_ng_module_factory_loader.spec.ts index 70809a1cdf..076f5c2a9f 100644 --- a/packages/router/test/spy_ng_module_factory_loader.spec.ts +++ b/packages/router/test/spy_ng_module_factory_loader.spec.ts @@ -23,7 +23,7 @@ describe('SpyNgModuleFactoryLoader', () => { }); it('should return the created promise', () => { - const expected = Promise.resolve('returned'); + const expected: any = Promise.resolve('returned'); const compiler: any = {compileModuleAsync: () => expected}; const r = new SpyNgModuleFactoryLoader(compiler); diff --git a/packages/service-worker/test/comm_spec.ts b/packages/service-worker/test/comm_spec.ts index 7fcaf3c849..4a3388a317 100644 --- a/packages/service-worker/test/comm_spec.ts +++ b/packages/service-worker/test/comm_spec.ts @@ -387,35 +387,35 @@ import {async_fit, async_it} from './async'; }); it('processes update availability notifications when sent', (done: DoneFn) => { update.available.subscribe(event => { - expect(event.current).toEqual({version: 'A'}); - expect(event.available).toEqual({version: 'B'}); + expect(event.current).toEqual({hash: 'A'}); + expect(event.available).toEqual({hash: 'B'}); expect(event.type).toEqual('UPDATE_AVAILABLE'); done(); }); mock.sendMessage({ type: 'UPDATE_AVAILABLE', current: { - version: 'A', + hash: 'A', }, available: { - version: 'B', + hash: 'B', }, }); }); it('processes update activation notifications when sent', (done: DoneFn) => { update.activated.subscribe(event => { - expect(event.previous).toEqual({version: 'A'}); - expect(event.current).toEqual({version: 'B'}); + expect(event.previous).toEqual({hash: 'A'}); + expect(event.current).toEqual({hash: 'B'}); expect(event.type).toEqual('UPDATE_ACTIVATED'); done(); }); mock.sendMessage({ type: 'UPDATE_ACTIVATED', previous: { - version: 'A', + hash: 'A', }, current: { - version: 'B', + hash: 'B', }, }); }); diff --git a/packages/tsconfig.json b/packages/tsconfig.json index c7892b33e0..99c52620a9 100644 --- a/packages/tsconfig.json +++ b/packages/tsconfig.json @@ -30,10 +30,11 @@ }, "exclude": [ "bazel", - "compiler-cli/integrationtest", - "platform-server/integrationtest", "common/locales", - "elements/schematics" + "compiler-cli/integrationtest", + "elements/schematics", + "examples/**/e2e_test/*", + "platform-server/integrationtest" ] } diff --git a/packages/types.d.ts b/packages/types.d.ts index 96996ea8e0..eb1d9387a5 100644 --- a/packages/types.d.ts +++ b/packages/types.d.ts @@ -8,20 +8,19 @@ // This file contains all ambient imports needed to compile the modules/ source code -/// /// /// /// -/// +/// /// -/// /// +/// declare let isNode: boolean; declare let isBrowser: boolean; declare namespace jasmine { - interface Matchers { + interface Matchers { toHaveProperties(obj: any): boolean; } } diff --git a/packages/upgrade/test/static/integration/downgrade_component_spec.ts b/packages/upgrade/test/static/integration/downgrade_component_spec.ts index cff3718529..3e9284bf4b 100644 --- a/packages/upgrade/test/static/integration/downgrade_component_spec.ts +++ b/packages/upgrade/test/static/integration/downgrade_component_spec.ts @@ -787,7 +787,7 @@ withEachNg1Version(() => { childMod.componentFactoryResolver.resolveComponentFactory(LazyLoadedComponent) !; const lazyCmp = cmpFactory.create(componentInjector); - expect(lazyCmp.instance.module).toBe(childMod.injector); + expect(lazyCmp.instance.module.injector).toBe(childMod.injector); }); })); diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index b7583dd767..a14dab89ac 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -60,5 +60,6 @@ travisFoldEnd "tsc tools" travisFoldStart "tsc all" node dist/tools/@angular/compiler-cli/src/main -p packages/tsconfig-metadata.json $(npm bin)/tsc -p packages + $(npm bin)/tsc -p packages/examples $(npm bin)/tsc -p modules travisFoldEnd "tsc all" diff --git a/tools/public_api_guard/router/router.d.ts b/tools/public_api_guard/router/router.d.ts index 91b0190edd..aa15b85b3b 100644 --- a/tools/public_api_guard/router/router.d.ts +++ b/tools/public_api_guard/router/router.d.ts @@ -533,9 +533,7 @@ export declare abstract class UrlSerializer { export declare class UrlTree { fragment: string | null; readonly queryParamMap: ParamMap; - queryParams: { - [key: string]: string; - }; + queryParams: Params; root: UrlSegmentGroup; toString(): string; } diff --git a/tools/tsc-watch/index.ts b/tools/tsc-watch/index.ts index 26080d13ab..cd3065ec1e 100644 --- a/tools/tsc-watch/index.ts +++ b/tools/tsc-watch/index.ts @@ -40,10 +40,7 @@ const BaseConfig = { }; if (platform == 'node') { - const specFiles = [ - '@angular/**/*_spec.js', '@angular/compiler-cli/test/**/*_spec.js', - '@angular/benchpress/test/**/*_spec.js' - ]; + const specFiles = ['@angular/**/*_spec.js']; tscWatch = new TscWatch(Object.assign( { tsconfig: 'packages/tsconfig.json', diff --git a/tools/types-ext/jasminewd2.d.ts b/tools/types-ext/jasminewd2.d.ts new file mode 100644 index 0000000000..b02a501695 --- /dev/null +++ b/tools/types-ext/jasminewd2.d.ts @@ -0,0 +1,28 @@ +/** + * @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 + */ + +/** + * Extended typings for `jasminewd2`. + * + * The currently used `jasminewd2` version (v2.1.0), supports passing a `done` callback to a spec, + * but the latest typings on [DefinitelyTyped][1] do not reflect that. + * Overwrite the relevant function signatures to add a `done` callback. + * + * [1]: + * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/566e0394859fdc1dc893658ccec6b06372d56a91/types/jasminewd2/index.d.ts#L9-L15 + */ +declare function it( + expectation: string, assertion?: (done: DoneFn) => Promise, timeout?: number): void; + declare function fit( + expectation: string, assertion?: (done: DoneFn) => Promise, timeout?: number): void; + declare function xit( + expectation: string, assertion?: (done: DoneFn) => Promise, timeout?: number): void; + declare function beforeEach(action: (done: DoneFn) => Promise, timeout?: number): void; + declare function afterEach(action: (done: DoneFn) => Promise, timeout?: number): void; + declare function beforeAll(action: (done: DoneFn) => Promise, timeout?: number): void; + declare function afterAll(action: (done: DoneFn) => Promise, timeout?: number): void; diff --git a/yarn.lock b/yarn.lock index 36ff64d652..66b1faeecd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -96,9 +96,15 @@ version "2.0.35" resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.35.tgz#7b7c950c7d54593e23bffc8d2b4feba9866a7277" -"@types/jasmine@2.2.22-alpha": - version "2.2.22-alpha" - resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.2.22-alpha.tgz#eecaee43fe42ef6b5cfefad1bcc370c433f485bf" +"@types/jasmine@*", "@types/jasmine@^2.8.8": + version "2.8.8" + resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.8.tgz#bf53a7d193ea8b03867a38bfdb4fbb0e0bf066c9" + +"@types/jasminewd2@^2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/jasminewd2/-/jasminewd2-2.0.3.tgz#0d2886b0cbdae4c0eeba55e30792f584bf040a95" + dependencies: + "@types/jasmine" "*" "@types/minimatch@*": version "3.0.3" @@ -2517,13 +2523,6 @@ glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.1, glo once "^1.3.0" path-is-absolute "^1.0.0" -glob@^3.2.11: - version "3.2.11" - resolved "https://registry.yarnpkg.com/glob/-/glob-3.2.11.tgz#4a973f635b9190f715d10987d5c00fd2815ebe3d" - dependencies: - inherits "2" - minimatch "0.3" - glob@^4.3.1: version "4.5.3" resolved "https://registry.yarnpkg.com/glob/-/glob-4.5.3.tgz#c6cb73d3226c1efef04de3c56d012f03377ee15f" @@ -3256,11 +3255,7 @@ isstream@~0.1.1, isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" -jasmine-core@2.4.1, jasmine-core@~2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.4.1.tgz#6f83ab3a0f16951722ce07d206c773d57cc838be" - -jasmine-core@~2.8.0: +jasmine-core@2.8, jasmine-core@~2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-2.8.0.tgz#bcc979ae1f9fd05701e45e52e65d3a5d63f1a24e" @@ -3270,15 +3265,7 @@ jasmine-diff@^0.1.3: dependencies: diff "^3.2.0" -jasmine@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.4.1.tgz#9016dda453213d27ac6d43dc4ea97315a189085e" - dependencies: - exit "^0.1.2" - glob "^3.2.11" - jasmine-core "~2.4.0" - -jasmine@^2.5.3: +jasmine@2.8, jasmine@^2.5.3: version "2.8.0" resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-2.8.0.tgz#6b089c0a11576b1f16df11b80146d91d4e8b8a3e" dependencies: @@ -3993,13 +3980,6 @@ mimic-fn@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" -minimatch@0.3: - version "0.3.0" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.3.0.tgz#275d8edaac4f1bb3326472089e7949c8394699dd" - dependencies: - lru-cache "2" - sigmund "~1.0.0" - "minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"