diff --git a/integration/bazel/package.json b/integration/bazel/package.json index 047b13fb2b..60e6c5dc8c 100644 --- a/integration/bazel/package.json +++ b/integration/bazel/package.json @@ -35,7 +35,7 @@ "rollup-plugin-node-resolve": "5.2.0", "rollup-plugin-sourcemaps": "0.4.2", "terser": "4.3.9", - "typescript": "3.6.4" + "typescript": "3.7.4" }, "scripts": { "test": "bazel build ... --noshow_progress && bazel test ...", diff --git a/integration/bazel/yarn.lock b/integration/bazel/yarn.lock index 8c23c3dc0f..0ee2375dfe 100644 --- a/integration/bazel/yarn.lock +++ b/integration/bazel/yarn.lock @@ -3397,10 +3397,10 @@ type-is@~1.6.17: media-typer "0.3.0" mime-types "~2.1.24" -typescript@3.6.4: - version "3.6.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" - integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg== +typescript@3.7.4: + version "3.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.4.tgz#1743a5ec5fef6a1fa9f3e4708e33c81c73876c19" + integrity sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw== typescript@~3.5.3: version "3.5.3" diff --git a/integration/typings_test_ts37/include-all.ts b/integration/typings_test_ts37/include-all.ts new file mode 100644 index 0000000000..116ba30903 --- /dev/null +++ b/integration/typings_test_ts37/include-all.ts @@ -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, +}; diff --git a/integration/typings_test_ts37/package.json b/integration/typings_test_ts37/package.json new file mode 100644 index 0000000000..c4fe8e5d36 --- /dev/null +++ b/integration/typings_test_ts37/package.json @@ -0,0 +1,30 @@ +{ + "name": "angular-integration", + "description": "Assert that users with TypeScript 3.7 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.7.3", + "zone.js": "file:../../dist/bin/packages/zone.js/npm_package" + }, + "scripts": { + "test": "tsc" + } +} diff --git a/integration/typings_test_ts37/tsconfig.json b/integration/typings_test_ts37/tsconfig.json new file mode 100644 index 0000000000..70c8db79e1 --- /dev/null +++ b/integration/typings_test_ts37/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "module": "commonjs", + "moduleResolution": "node", + "outDir": "../../dist/typings_test_ts37/", + "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" + ] +} diff --git a/package.json b/package.json index f41a6fbf71..4111a3b2f4 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "tsickle": "0.37.1", "tslib": "^1.10.0", "tslint": "5.7.0", - "typescript": "~3.6.4", + "typescript": "~3.7.4", "xhr2": "0.1.4", "yargs": "13.1.0" }, diff --git a/packages/bazel/package.json b/packages/bazel/package.json index 4781f93cd3..4e8d86c450 100644 --- a/packages/bazel/package.json +++ b/packages/bazel/package.json @@ -34,7 +34,7 @@ "@angular/compiler-cli": "0.0.0-PLACEHOLDER", "@bazel/typescript": "0.*", "terser": "^4.3.1", - "typescript": ">=3.6 <3.7", + "typescript": ">=3.6 <3.8", "rollup": ">=1.20.0", "rollup-plugin-commonjs": ">=9.0.0", "rollup-plugin-node-resolve": ">=4.2.0", diff --git a/packages/compiler-cli/package.json b/packages/compiler-cli/package.json index bc70281ad6..5fae3fbaea 100644 --- a/packages/compiler-cli/package.json +++ b/packages/compiler-cli/package.json @@ -25,7 +25,7 @@ "peerDependencies": { "@angular/compiler": "0.0.0-PLACEHOLDER", "tslib": "^1.10.0", - "typescript": ">=3.6 <3.7" + "typescript": ">=3.6 <3.8" }, "engines": { "node": ">=8.0" diff --git a/packages/compiler-cli/src/typescript_support.ts b/packages/compiler-cli/src/typescript_support.ts index 9a4c430ba5..6e752f3e11 100644 --- a/packages/compiler-cli/src/typescript_support.ts +++ b/packages/compiler-cli/src/typescript_support.ts @@ -19,7 +19,7 @@ const MIN_TS_VERSION = '3.6.4'; * ∀ supported typescript version v, v < MAX_TS_VERSION * MAX_TS_VERSION is not considered as a supported TypeScript version */ -const MAX_TS_VERSION = '3.7.0'; +const MAX_TS_VERSION = '3.8.0'; /** * The currently used version of TypeScript, which can be adjusted for testing purposes using diff --git a/packages/core/src/di/injectable.ts b/packages/core/src/di/injectable.ts index 960f7bb101..cda90f63a4 100644 --- a/packages/core/src/di/injectable.ts +++ b/packages/core/src/di/injectable.ts @@ -9,7 +9,7 @@ import {Type} from '../interface/type'; import {TypeDecorator, makeDecorator} from '../util/decorators'; -import {InjectableType, getInjectableDef, ɵɵInjectableDef, ɵɵdefineInjectable} from './interface/defs'; +import {InjectableType, getInjectableDef, ɵɵdefineInjectable} from './interface/defs'; import {ClassSansProvider, ConstructorSansProvider, ExistingSansProvider, FactorySansProvider, StaticClassSansProvider, ValueSansProvider} from './interface/provider'; import {compileInjectable as render3CompileInjectable} from './jit/injectable'; import {convertInjectableProviderToFactory} from './util'; diff --git a/packages/language-service/src/typescript_symbols.ts b/packages/language-service/src/typescript_symbols.ts index 88b21d5d21..1c5b4bb0aa 100644 --- a/packages/language-service/src/typescript_symbols.ts +++ b/packages/language-service/src/typescript_symbols.ts @@ -157,8 +157,8 @@ class TypeScriptSymbolQuery implements SymbolQuery { const context: TypeContext = {node: this.source, program: this.program, checker: this.checker}; const typeSymbol = findClassSymbolInContext(type, context); if (typeSymbol) { - const contextType = this.getTemplateRefContextType(typeSymbol); - if (contextType) return new SymbolWrapper(contextType, context).members(); + const contextType = this.getTemplateRefContextType(typeSymbol, context); + if (contextType) return contextType.members(); } } @@ -186,7 +186,7 @@ class TypeScriptSymbolQuery implements SymbolQuery { return spanAt(this.source, line, column); } - private getTemplateRefContextType(typeSymbol: ts.Symbol): ts.Symbol|undefined { + private getTemplateRefContextType(typeSymbol: ts.Symbol, context: TypeContext): Symbol|undefined { const type = this.checker.getTypeOfSymbolAtLocation(typeSymbol, this.source); const constructor = type.symbol && type.symbol.members && getFromSymbolTable(type.symbol.members !, '__constructor'); @@ -196,9 +196,10 @@ class TypeScriptSymbolQuery implements SymbolQuery { for (const parameter of constructorDeclaration.parameters) { const type = this.checker.getTypeAtLocation(parameter.type !); if (type.symbol !.name == 'TemplateRef' && isReferenceType(type)) { - const typeReference = type as ts.TypeReference; - if (typeReference.typeArguments && typeReference.typeArguments.length === 1) { - return typeReference.typeArguments[0].symbol; + const typeWrapper = new TypeWrapper(type, context); + const typeArguments = typeWrapper.typeArguments(); + if (typeArguments && typeArguments.length === 1) { + return typeArguments[0]; } } } @@ -313,8 +314,15 @@ class TypeWrapper implements Symbol { } typeArguments(): Symbol[]|undefined { - // TODO: use checker.getTypeArguments when TS 3.7 lands in the monorepo. - const typeArguments: ReadonlyArray = (this.tsType as any).typeArguments; + if (!isReferenceType(this.tsType)) return; + + const typeReference = (this.tsType as ts.TypeReference); + let typeArguments: ReadonlyArray|undefined; + if (this.context.checker.getTypeArguments) { + typeArguments = this.context.checker.getTypeArguments(typeReference); + } else { + typeArguments = typeReference.typeArguments; + } if (!typeArguments) return undefined; return typeArguments.map(ta => new TypeWrapper(ta, this.context)); } diff --git a/packages/platform-server/src/tokens.ts b/packages/platform-server/src/tokens.ts index 870b900f9c..ebb0bf23ee 100644 --- a/packages/platform-server/src/tokens.ts +++ b/packages/platform-server/src/tokens.ts @@ -32,4 +32,4 @@ export const INITIAL_CONFIG = new InjectionToken('Server.INITIAL * @publicApi */ export const BEFORE_APP_SERIALIZED = - new InjectionToken void>>('Server.RENDER_MODULE_HOOK'); + new InjectionToken void | Promise>>('Server.RENDER_MODULE_HOOK'); diff --git a/packages/zone.js/test/common/fetch.spec.ts b/packages/zone.js/test/common/fetch.spec.ts index 8df75786cd..2fe72e2ce2 100644 --- a/packages/zone.js/test/common/fetch.spec.ts +++ b/packages/zone.js/test/common/fetch.spec.ts @@ -150,7 +150,7 @@ describe( it('cancel fetch should invoke onCancelTask', ifEnvSupportsWithDone('AbortController', (done: DoneFn) => { - if (isSafari) { + if (isSafari()) { // safari not work with AbortController done(); return; @@ -177,7 +177,7 @@ describe( it('cancel fetchTask should trigger abort', ifEnvSupportsWithDone('AbortController', (done: DoneFn) => { - if (isSafari) { + if (isSafari()) { // safari not work with AbortController done(); return; diff --git a/tools/public_api_guard/common/common.d.ts b/tools/public_api_guard/common/common.d.ts index a240bb4c34..56845ae50d 100644 --- a/tools/public_api_guard/common/common.d.ts +++ b/tools/public_api_guard/common/common.d.ts @@ -188,10 +188,10 @@ export declare class LowerCasePipe implements PipeTransform { } export declare class NgClass extends NgClassBase implements DoCheck { - klass: string; - ngClass: string | string[] | Set | { + set klass(value: string); + set ngClass(value: string | string[] | Set | { [klass: string]: any; - }; + }); constructor(delegate: NgClassImpl); ngDoCheck(): void; } @@ -217,9 +217,10 @@ export declare class NgComponentOutlet implements OnChanges, OnDestroy { } export declare class NgForOf = NgIterable> implements DoCheck { - ngForOf: (U & NgIterable) | undefined | null; - ngForTemplate: TemplateRef>; - ngForTrackBy: TrackByFunction; + set ngForOf(ngForOf: (U & NgIterable) | undefined | null); + set ngForTemplate(value: TemplateRef>); + get ngForTrackBy(): TrackByFunction; + set ngForTrackBy(fn: TrackByFunction); constructor(_viewContainer: ViewContainerRef, _template: TemplateRef>, _differs: IterableDiffers); ngDoCheck(): void; static ngTemplateContextGuard>(dir: NgForOf, ctx: any): ctx is NgForOfContext; @@ -228,19 +229,19 @@ export declare class NgForOf = NgIterable> impleme export declare class NgForOfContext = NgIterable> { $implicit: T; count: number; - readonly even: boolean; - readonly first: boolean; + get even(): boolean; + get first(): boolean; index: number; - readonly last: boolean; + get last(): boolean; ngForOf: U; - readonly odd: boolean; + get odd(): boolean; constructor($implicit: T, ngForOf: U, index: number, count: number); } export declare class NgIf { - ngIf: T; - ngIfElse: TemplateRef> | null; - ngIfThen: TemplateRef> | null; + set ngIf(condition: T); + set ngIfElse(templateRef: TemplateRef> | null); + set ngIfThen(templateRef: TemplateRef> | null); constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef>); static ngTemplateGuard_ngIf: 'binding'; static ngTemplateContextGuard(dir: NgIf, ctx: any): ctx is NgIfContext; @@ -262,7 +263,7 @@ export declare abstract class NgLocalization { } export declare class NgPlural { - ngPlural: number; + set ngPlural(value: number); constructor(_localization: NgLocalization); addCase(value: string, switchView: SwitchView): void; } @@ -273,9 +274,9 @@ export declare class NgPluralCase { } export declare class NgStyle extends NgStyleBase implements DoCheck { - ngStyle: { + set ngStyle(value: { [klass: string]: any; - } | null; + } | null); constructor(delegate: NgStyleImpl); ngDoCheck(): void; } @@ -291,7 +292,7 @@ export declare class NgStyleBase { } export declare class NgSwitch { - ngSwitch: any; + set ngSwitch(newValue: any); } export declare class NgSwitchCase implements DoCheck { @@ -353,13 +354,13 @@ export declare class PercentPipe implements PipeTransform { } export declare abstract class PlatformLocation { - abstract readonly hash: string; - abstract readonly hostname: string; - abstract readonly href: string; - abstract readonly pathname: string; - abstract readonly port: string; - abstract readonly protocol: string; - abstract readonly search: string; + abstract get hash(): string; + abstract get hostname(): string; + abstract get href(): string; + abstract get pathname(): string; + abstract get port(): string; + abstract get protocol(): string; + abstract get search(): string; abstract back(): void; abstract forward(): void; abstract getBaseHrefFromDOM(): string; diff --git a/tools/public_api_guard/common/http/testing.d.ts b/tools/public_api_guard/common/http/testing.d.ts index 7387dc1486..72b5c10bb4 100644 --- a/tools/public_api_guard/common/http/testing.d.ts +++ b/tools/public_api_guard/common/http/testing.d.ts @@ -22,7 +22,7 @@ export interface RequestMatch { } export declare class TestRequest { - readonly cancelled: boolean; + get cancelled(): boolean; request: HttpRequest; constructor(request: HttpRequest, observer: Observer>); error(error: ErrorEvent, opts?: { diff --git a/tools/public_api_guard/common/testing.d.ts b/tools/public_api_guard/common/testing.d.ts index 11002fcd55..4b3f845e47 100644 --- a/tools/public_api_guard/common/testing.d.ts +++ b/tools/public_api_guard/common/testing.d.ts @@ -19,15 +19,15 @@ export declare class MockLocationStrategy extends LocationStrategy { } export declare class MockPlatformLocation implements PlatformLocation { - readonly hash: string; - readonly hostname: string; - readonly href: string; - readonly pathname: string; - readonly port: string; - readonly protocol: string; - readonly search: string; - readonly state: unknown; - readonly url: string; + get hash(): string; + get hostname(): string; + get href(): string; + get pathname(): string; + get port(): string; + get protocol(): string; + get search(): string; + get state(): unknown; + get url(): string; constructor(config?: MockPlatformLocationConfig); back(): void; forward(): void; diff --git a/tools/public_api_guard/core/core.d.ts b/tools/public_api_guard/core/core.d.ts index c4870b5c02..e2da2d0137 100644 --- a/tools/public_api_guard/core/core.d.ts +++ b/tools/public_api_guard/core/core.d.ts @@ -41,7 +41,7 @@ export declare class ApplicationRef { readonly componentTypes: Type[]; readonly components: ComponentRef[]; readonly isStable: Observable; - readonly viewCount: number; + get viewCount(): number; attachView(viewRef: ViewRef): void; bootstrap(componentOrFactory: ComponentFactory | Type, rootSelectorOrNode?: string | any): ComponentRef; detachView(viewRef: ViewRef): void; @@ -136,17 +136,17 @@ export interface ComponentDecorator { } export declare abstract class ComponentFactory { - abstract readonly componentType: Type; - abstract readonly inputs: { + abstract get componentType(): Type; + abstract get inputs(): { propName: string; templateName: string; }[]; - abstract readonly ngContentSelectors: string[]; - abstract readonly outputs: { + abstract get ngContentSelectors(): string[]; + abstract get outputs(): { propName: string; templateName: string; }[]; - abstract readonly selector: string; + abstract get selector(): string; abstract create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string | any, ngModule?: NgModuleRef): ComponentRef; } @@ -156,12 +156,12 @@ export declare abstract class ComponentFactoryResolver { } export declare abstract class ComponentRef { - abstract readonly changeDetectorRef: ChangeDetectorRef; - abstract readonly componentType: Type; - abstract readonly hostView: ViewRef; - abstract readonly injector: Injector; - abstract readonly instance: C; - abstract readonly location: ElementRef; + abstract get changeDetectorRef(): ChangeDetectorRef; + abstract get componentType(): Type; + abstract get hostView(): ViewRef; + abstract get injector(): Injector; + abstract get instance(): C; + abstract get location(): ElementRef; abstract destroy(): void; abstract onDestroy(callback: Function): void; } @@ -262,7 +262,7 @@ export declare const DEFAULT_CURRENCY_CODE: InjectionToken; /** @deprecated */ export declare class DefaultIterableDiffer implements IterableDiffer, IterableChanges { readonly collection: V[] | Iterable | null; - readonly isDirty: boolean; + get isDirty(): boolean; readonly length: number; constructor(trackByFn?: TrackByFunction); check(collection: NgIterable): boolean; @@ -318,8 +318,8 @@ export declare class ElementRef { } export declare abstract class EmbeddedViewRef extends ViewRef { - abstract readonly context: C; - abstract readonly rootNodes: any[]; + abstract get context(): C; + abstract get rootNodes(): any[]; } export declare function enableProdMode(): void; @@ -601,7 +601,7 @@ export interface NgModuleDecorator { } export declare abstract class NgModuleFactory { - abstract readonly moduleType: Type; + abstract get moduleType(): Type; abstract create(parentInjector: Injector | null): NgModuleRef; } @@ -611,9 +611,9 @@ export declare abstract class NgModuleFactoryLoader { } export declare abstract class NgModuleRef { - abstract readonly componentFactoryResolver: ComponentFactoryResolver; - abstract readonly injector: Injector; - abstract readonly instance: T; + abstract get componentFactoryResolver(): ComponentFactoryResolver; + abstract get injector(): Injector; + abstract get instance(): T; abstract destroy(): void; abstract onDestroy(callback: () => void): void; } @@ -780,7 +780,7 @@ export declare function ɵɵdefineComponent(componentDefinition: { export declare const ɵɵdefineDirective: (directiveDefinition: { type: Type; - selectors?: (string | SelectorFlags)[][] | undefined; + selectors?: CssSelectorList | undefined; inputs?: { [P in keyof T]?: string | [string, string] | undefined; } | undefined; outputs?: { [P_1 in keyof T]?: string | undefined; } | undefined; features?: DirectiveDefFeature[] | undefined; @@ -1114,8 +1114,8 @@ export declare const PLATFORM_INITIALIZER: InjectionToken<(() => void)[]>; export declare const platformCore: (extraProviders?: StaticProvider[] | undefined) => PlatformRef; export declare class PlatformRef { - readonly destroyed: boolean; - readonly injector: Injector; + get destroyed(): boolean; + get injector(): Injector; bootstrapModule(moduleType: Type, compilerOptions?: (CompilerOptions & BootstrapOptions) | Array): Promise>; bootstrapModuleFactory(moduleFactory: NgModuleFactory, options?: BootstrapOptions): Promise>; destroy(): void; @@ -1164,7 +1164,7 @@ export declare class QueryList implements Iterable { /** @deprecated */ export declare abstract class ReflectiveInjector implements Injector { - abstract readonly parent: Injector | null; + abstract get parent(): Injector | null; abstract createChildFromResolved(providers: ResolvedReflectiveProvider[]): ReflectiveInjector; abstract get(token: any, notFoundValue?: any): any; abstract instantiateResolved(provider: ResolvedReflectiveProvider): any; @@ -1181,12 +1181,12 @@ export declare class ReflectiveKey { id: number; token: Object; constructor(token: Object, id: number); - static readonly numberOfKeys: number; + static get numberOfKeys(): number; static get(token: Object): ReflectiveKey; } export declare abstract class Renderer2 { - abstract readonly data: { + abstract get data(): { [key: string]: any; }; destroyNode: ((node: any) => void) | null; @@ -1325,7 +1325,7 @@ export declare abstract class SystemJsNgModuleLoaderConfig { } export declare abstract class TemplateRef { - abstract readonly elementRef: ElementRef; + abstract get elementRef(): ElementRef; abstract createEmbeddedView(context: C): EmbeddedViewRef; } @@ -1412,10 +1412,10 @@ export interface ViewChildrenDecorator { } export declare abstract class ViewContainerRef { - abstract readonly element: ElementRef; - abstract readonly injector: Injector; - abstract readonly length: number; - /** @deprecated */ abstract readonly parentInjector: Injector; + abstract get element(): ElementRef; + abstract get injector(): Injector; + abstract get length(): number; + /** @deprecated */ abstract get parentInjector(): Injector; abstract clear(): void; abstract createComponent(componentFactory: ComponentFactory, index?: number, injector?: Injector, projectableNodes?: any[][], ngModule?: NgModuleRef): ComponentRef; abstract createEmbeddedView(templateRef: TemplateRef, context?: C, index?: number): EmbeddedViewRef; @@ -1435,7 +1435,7 @@ export declare enum ViewEncapsulation { } export declare abstract class ViewRef extends ChangeDetectorRef { - abstract readonly destroyed: boolean; + abstract get destroyed(): boolean; abstract destroy(): void; abstract onDestroy(callback: Function): any /** TODO #9100 */; } diff --git a/tools/public_api_guard/forms/forms.d.ts b/tools/public_api_guard/forms/forms.d.ts index 68b73fc058..52b979cd50 100644 --- a/tools/public_api_guard/forms/forms.d.ts +++ b/tools/public_api_guard/forms/forms.d.ts @@ -1,20 +1,20 @@ export declare abstract class AbstractControl { asyncValidator: AsyncValidatorFn | null; - readonly dirty: boolean; - readonly disabled: boolean; - readonly enabled: boolean; + get dirty(): boolean; + get disabled(): boolean; + get enabled(): boolean; readonly errors: ValidationErrors | null; - readonly invalid: boolean; - readonly parent: FormGroup | FormArray; - readonly pending: boolean; + get invalid(): boolean; + get parent(): FormGroup | FormArray; + get pending(): boolean; readonly pristine: boolean; - readonly root: AbstractControl; + get root(): AbstractControl; readonly status: string; readonly statusChanges: Observable; readonly touched: boolean; - readonly untouched: boolean; - readonly updateOn: FormHooks; - readonly valid: boolean; + get untouched(): boolean; + get updateOn(): FormHooks; + get valid(): boolean; validator: ValidatorFn | null; readonly value: any; readonly valueChanges: Observable; @@ -65,22 +65,22 @@ export declare abstract class AbstractControl { } export declare abstract class AbstractControlDirective { - abstract readonly control: AbstractControl | null; - readonly dirty: boolean | null; - readonly disabled: boolean | null; - readonly enabled: boolean | null; - readonly errors: ValidationErrors | null; - readonly invalid: boolean | null; - readonly path: string[] | null; - readonly pending: boolean | null; - readonly pristine: boolean | null; - readonly status: string | null; - readonly statusChanges: Observable | null; - readonly touched: boolean | null; - readonly untouched: boolean | null; - readonly valid: boolean | null; - readonly value: any; - readonly valueChanges: Observable | null; + abstract get control(): AbstractControl | null; + get dirty(): boolean | null; + get disabled(): boolean | null; + get enabled(): boolean | null; + get errors(): ValidationErrors | null; + get invalid(): boolean | null; + get path(): string[] | null; + get pending(): boolean | null; + get pristine(): boolean | null; + get status(): string | null; + get statusChanges(): Observable | null; + get touched(): boolean | null; + get untouched(): boolean | null; + get valid(): boolean | null; + get value(): any; + get valueChanges(): Observable | null; getError(errorCode: string, path?: Array | string): any; hasError(errorCode: string, path?: Array | string): boolean; reset(value?: any): void; @@ -93,11 +93,11 @@ export interface AbstractControlOptions { } export declare class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy { - readonly asyncValidator: AsyncValidatorFn | null; - readonly control: FormGroup; - readonly formDirective: Form | null; - readonly path: string[]; - readonly validator: ValidatorFn | null; + get asyncValidator(): AsyncValidatorFn | null; + get control(): FormGroup; + get formDirective(): Form | null; + get path(): string[]; + get validator(): ValidatorFn | null; ngOnDestroy(): void; ngOnInit(): void; } @@ -127,9 +127,9 @@ export declare class CheckboxRequiredValidator extends RequiredValidator { export declare const COMPOSITION_BUFFER_MODE: InjectionToken; export declare abstract class ControlContainer extends AbstractControlDirective { - readonly formDirective: Form | null; + get formDirective(): Form | null; name: string | number | null; - readonly path: string[] | null; + get path(): string[] | null; } export interface ControlValueAccessor { @@ -150,7 +150,7 @@ export declare class DefaultValueAccessor implements ControlValueAccessor { } export declare class EmailValidator implements Validator { - email: boolean | string; + set email(value: boolean | string); registerOnValidatorChange(fn: () => void): void; validate(control: AbstractControl): ValidationErrors | null; } @@ -167,7 +167,7 @@ export interface Form { export declare class FormArray extends AbstractControl { controls: AbstractControl[]; - readonly length: number; + get length(): number; constructor(controls: AbstractControl[], validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null); at(index: number): AbstractControl; clear(): void; @@ -191,12 +191,12 @@ export declare class FormArray extends AbstractControl { } export declare class FormArrayName extends ControlContainer implements OnInit, OnDestroy { - readonly asyncValidator: AsyncValidatorFn | null; - readonly control: FormArray; - readonly formDirective: FormGroupDirective | null; + get asyncValidator(): AsyncValidatorFn | null; + get control(): FormArray; + get formDirective(): FormGroupDirective | null; name: string | number | null; - readonly path: string[]; - readonly validator: ValidatorFn | null; + get path(): string[]; + get validator(): ValidatorFn | null; constructor(parent: ControlContainer, validators: any[], asyncValidators: any[]); ngOnDestroy(): void; ngOnInit(): void; @@ -235,14 +235,14 @@ export declare class FormControl extends AbstractControl { } export declare class FormControlDirective extends NgControl implements OnChanges { - readonly asyncValidator: AsyncValidatorFn | null; - readonly control: FormControl; + get asyncValidator(): AsyncValidatorFn | null; + get control(): FormControl; form: FormControl; - isDisabled: boolean; + set isDisabled(isDisabled: boolean); /** @deprecated */ model: any; - readonly path: string[]; + get path(): string[]; /** @deprecated */ update: EventEmitter; - readonly validator: ValidatorFn | null; + get validator(): ValidatorFn | null; viewModel: any; constructor(validators: Array, asyncValidators: Array, valueAccessors: ControlValueAccessor[], _ngModelWarningConfig: string | null); ngOnChanges(changes: SimpleChanges): void; @@ -250,15 +250,15 @@ export declare class FormControlDirective extends NgControl implements OnChanges } export declare class FormControlName extends NgControl implements OnChanges, OnDestroy { - readonly asyncValidator: AsyncValidatorFn; + get asyncValidator(): AsyncValidatorFn; readonly control: FormControl; - readonly formDirective: any; - isDisabled: boolean; + get formDirective(): any; + set isDisabled(isDisabled: boolean); /** @deprecated */ model: any; name: string | number | null; - readonly path: string[]; + get path(): string[]; /** @deprecated */ update: EventEmitter; - readonly validator: ValidatorFn | null; + get validator(): ValidatorFn | null; constructor(parent: ControlContainer, validators: Array, asyncValidators: Array, valueAccessors: ControlValueAccessor[], _ngModelWarningConfig: string | null); ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; @@ -297,12 +297,12 @@ export declare class FormGroup extends AbstractControl { } export declare class FormGroupDirective extends ControlContainer implements Form, OnChanges { - readonly control: FormGroup; + get control(): FormGroup; directives: FormControlName[]; form: FormGroup; - readonly formDirective: Form; + get formDirective(): Form; ngSubmit: EventEmitter; - readonly path: string[]; + get path(): string[]; readonly submitted: boolean; constructor(_validators: any[], _asyncValidators: any[]); addControl(dir: FormControlName): FormControl; @@ -350,9 +350,9 @@ export declare const NG_VALIDATORS: InjectionToken<(Function | Validator)[]>; export declare const NG_VALUE_ACCESSOR: InjectionToken; export declare abstract class NgControl extends AbstractControlDirective { - readonly asyncValidator: AsyncValidatorFn | null; + get asyncValidator(): AsyncValidatorFn | null; name: string | number | null; - readonly validator: ValidatorFn | null; + get validator(): ValidatorFn | null; valueAccessor: ControlValueAccessor | null; abstract viewToModelUpdate(newValue: any): void; } @@ -366,17 +366,17 @@ export declare class NgControlStatusGroup extends AbstractControlStatus { } export declare class NgForm extends ControlContainer implements Form, AfterViewInit { - readonly control: FormGroup; - readonly controls: { + get control(): FormGroup; + get controls(): { [key: string]: AbstractControl; }; form: FormGroup; - readonly formDirective: Form; + get formDirective(): Form; ngSubmit: EventEmitter; options: { updateOn?: FormHooks; }; - readonly path: string[]; + get path(): string[]; readonly submitted: boolean; constructor(validators: any[], asyncValidators: any[]); addControl(dir: NgModel): void; @@ -396,9 +396,9 @@ export declare class NgForm extends ControlContainer implements Form, AfterViewI } export declare class NgModel extends NgControl implements OnChanges, OnDestroy { - readonly asyncValidator: AsyncValidatorFn | null; + get asyncValidator(): AsyncValidatorFn | null; readonly control: FormControl; - readonly formDirective: any; + get formDirective(): any; isDisabled: boolean; model: any; name: string; @@ -407,9 +407,9 @@ export declare class NgModel extends NgControl implements OnChanges, OnDestroy { standalone?: boolean; updateOn?: FormHooks; }; - readonly path: string[]; + get path(): string[]; update: EventEmitter; - readonly validator: ValidatorFn | null; + get validator(): ValidatorFn | null; viewModel: any; constructor(parent: ControlContainer, validators: Array, asyncValidators: Array, valueAccessors: ControlValueAccessor[]); ngOnChanges(changes: SimpleChanges): void; @@ -425,8 +425,8 @@ export declare class NgModelGroup extends AbstractFormGroupDirective implements export declare class NgSelectOption implements OnDestroy { id: string; - ngValue: any; - value: any; + set ngValue(value: any); + set value(value: any); constructor(_element: ElementRef, _renderer: Renderer2, _select: SelectControlValueAccessor); ngOnDestroy(): void; } @@ -480,13 +480,14 @@ export declare class ReactiveFormsModule { } export declare class RequiredValidator implements Validator { - required: boolean | string; + get required(): boolean | string; + set required(value: boolean | string); registerOnValidatorChange(fn: () => void): void; validate(control: AbstractControl): ValidationErrors | null; } export declare class SelectControlValueAccessor implements ControlValueAccessor { - compareWith: (o1: any, o2: any) => boolean; + set compareWith(fn: (o1: any, o2: any) => boolean); onChange: (_: any) => void; onTouched: () => void; value: any; @@ -498,7 +499,7 @@ export declare class SelectControlValueAccessor implements ControlValueAccessor } export declare class SelectMultipleControlValueAccessor implements ControlValueAccessor { - compareWith: (o1: any, o2: any) => boolean; + set compareWith(fn: (o1: any, o2: any) => boolean); onChange: (_: any) => void; onTouched: () => void; value: any; diff --git a/tools/public_api_guard/http/http.d.ts b/tools/public_api_guard/http/http.d.ts index e34b4aa541..edc79a97b0 100644 --- a/tools/public_api_guard/http/http.d.ts +++ b/tools/public_api_guard/http/http.d.ts @@ -142,7 +142,8 @@ export declare class RequestOptions { method: RequestMethod | string | null; params: URLSearchParams; responseType: ResponseContentType | null; - /** @deprecated */ search: URLSearchParams; + /** @deprecated */ set search(params: URLSearchParams); + /** @deprecated */ get search(): URLSearchParams; url: string | null; withCredentials: boolean | null; constructor(opts?: RequestOptionsArgs); diff --git a/tools/public_api_guard/platform-server/platform-server.d.ts b/tools/public_api_guard/platform-server/platform-server.d.ts index d81559ba50..479c315e9c 100644 --- a/tools/public_api_guard/platform-server/platform-server.d.ts +++ b/tools/public_api_guard/platform-server/platform-server.d.ts @@ -1,4 +1,4 @@ -export declare const BEFORE_APP_SERIALIZED: InjectionToken<(() => void)[]>; +export declare const BEFORE_APP_SERIALIZED: InjectionToken<(() => void | Promise)[]>; export declare const INITIAL_CONFIG: InjectionToken; diff --git a/tools/public_api_guard/router/router.d.ts b/tools/public_api_guard/router/router.d.ts index 48bd09e57d..cb6db66157 100644 --- a/tools/public_api_guard/router/router.d.ts +++ b/tools/public_api_guard/router/router.d.ts @@ -1,37 +1,37 @@ export declare class ActivatedRoute { - readonly children: ActivatedRoute[]; + get children(): ActivatedRoute[]; component: Type | string | null; data: Observable; - readonly firstChild: ActivatedRoute | null; + get firstChild(): ActivatedRoute | null; fragment: Observable; outlet: string; - readonly paramMap: Observable; + get paramMap(): Observable; params: Observable; - readonly parent: ActivatedRoute | null; - readonly pathFromRoot: ActivatedRoute[]; - readonly queryParamMap: Observable; + get parent(): ActivatedRoute | null; + get pathFromRoot(): ActivatedRoute[]; + get queryParamMap(): Observable; queryParams: Observable; - readonly root: ActivatedRoute; - readonly routeConfig: Route | null; + get root(): ActivatedRoute; + get routeConfig(): Route | null; snapshot: ActivatedRouteSnapshot; url: Observable; toString(): string; } export declare class ActivatedRouteSnapshot { - readonly children: ActivatedRouteSnapshot[]; + get children(): ActivatedRouteSnapshot[]; component: Type | string | null; data: Data; - readonly firstChild: ActivatedRouteSnapshot | null; + get firstChild(): ActivatedRouteSnapshot | null; fragment: string; outlet: string; - readonly paramMap: ParamMap; + get paramMap(): ParamMap; params: Params; - readonly parent: ActivatedRouteSnapshot | null; - readonly pathFromRoot: ActivatedRouteSnapshot[]; - readonly queryParamMap: ParamMap; + get parent(): ActivatedRouteSnapshot | null; + get pathFromRoot(): ActivatedRouteSnapshot[]; + get queryParamMap(): ParamMap; queryParams: Params; - readonly root: ActivatedRouteSnapshot; + get root(): ActivatedRouteSnapshot; readonly routeConfig: Route | null; url: UrlSegment[]; toString(): string; @@ -333,7 +333,7 @@ export declare class Router { relativeLinkResolution: 'legacy' | 'corrected'; routeReuseStrategy: RouteReuseStrategy; readonly routerState: RouterState; - readonly url: string; + get url(): string; urlHandlingStrategy: UrlHandlingStrategy; urlUpdateStrategy: 'deferred' | 'eager'; constructor(rootComponentType: Type | null, urlSerializer: UrlSerializer, rootContexts: ChildrenOutletContexts, location: Location, injector: Injector, loader: NgModuleFactoryLoader, compiler: Compiler, config: Routes); @@ -374,18 +374,18 @@ export declare class RouterEvent { export declare class RouterLink { fragment: string; preserveFragment: boolean; - /** @deprecated */ preserveQueryParams: boolean; + /** @deprecated */ set preserveQueryParams(value: boolean); queryParams: { [k: string]: any; }; queryParamsHandling: QueryParamsHandling; replaceUrl: boolean; - routerLink: any[] | string; + set routerLink(commands: any[] | string); skipLocationChange: boolean; state?: { [k: string]: any; }; - readonly urlTree: UrlTree; + get urlTree(): UrlTree; constructor(router: Router, route: ActivatedRoute, tabIndex: string, renderer: Renderer2, el: ElementRef); onClick(): boolean; } @@ -394,7 +394,7 @@ export declare class RouterLinkActive implements OnChanges, OnDestroy, AfterCont readonly isActive: boolean; links: QueryList; linksWithHrefs: QueryList; - routerLinkActive: string[] | string; + set routerLinkActive(data: string[] | string); routerLinkActiveOptions: { exact: boolean; }; @@ -408,19 +408,19 @@ export declare class RouterLinkWithHref implements OnChanges, OnDestroy { fragment: string; href: string; preserveFragment: boolean; - preserveQueryParams: boolean; + set preserveQueryParams(value: boolean); queryParams: { [k: string]: any; }; queryParamsHandling: QueryParamsHandling; replaceUrl: boolean; - routerLink: any[] | string; + set routerLink(commands: any[] | string); skipLocationChange: boolean; state?: { [k: string]: any; }; target: string; - readonly urlTree: UrlTree; + get urlTree(): UrlTree; constructor(router: Router, route: ActivatedRoute, locationStrategy: LocationStrategy); ngOnChanges(changes: {}): any; ngOnDestroy(): any; @@ -435,11 +435,11 @@ export declare class RouterModule { export declare class RouterOutlet implements OnDestroy, OnInit { activateEvents: EventEmitter; - readonly activatedRoute: ActivatedRoute; - readonly activatedRouteData: Data; - readonly component: Object; + get activatedRoute(): ActivatedRoute; + get activatedRouteData(): Data; + get component(): Object; deactivateEvents: EventEmitter; - readonly isActivated: boolean; + get isActivated(): boolean; constructor(parentContexts: ChildrenOutletContexts, location: ViewContainerRef, resolver: ComponentFactoryResolver, name: string, changeDetector: ChangeDetectorRef); activateWith(activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver | null): void; attach(ref: ComponentRef, activatedRoute: ActivatedRoute): void; @@ -510,7 +510,7 @@ export declare type UrlMatchResult = { }; export declare class UrlSegment { - readonly parameterMap: ParamMap; + get parameterMap(): ParamMap; parameters: { [name: string]: string; }; @@ -527,7 +527,7 @@ export declare class UrlSegmentGroup { children: { [key: string]: UrlSegmentGroup; }; - readonly numberOfChildren: number; + get numberOfChildren(): number; parent: UrlSegmentGroup | null; segments: UrlSegment[]; constructor( @@ -546,7 +546,7 @@ export declare abstract class UrlSerializer { export declare class UrlTree { fragment: string | null; - readonly queryParamMap: ParamMap; + get queryParamMap(): ParamMap; queryParams: Params; root: UrlSegmentGroup; toString(): string; diff --git a/tools/public_api_guard/router/testing.d.ts b/tools/public_api_guard/router/testing.d.ts index a6396352c0..39a5574924 100644 --- a/tools/public_api_guard/router/testing.d.ts +++ b/tools/public_api_guard/router/testing.d.ts @@ -6,7 +6,10 @@ export declare function setupTestingRouter(urlSerializer: UrlSerializer, context export declare function setupTestingRouter(urlSerializer: UrlSerializer, contexts: ChildrenOutletContexts, location: Location, loader: NgModuleFactoryLoader, compiler: Compiler, injector: Injector, routes: Route[][], urlHandlingStrategy?: UrlHandlingStrategy): Router; export declare class SpyNgModuleFactoryLoader implements NgModuleFactoryLoader { - stubbedModules: { + set stubbedModules(modules: { + [path: string]: any; + }); + get stubbedModules(): { [path: string]: any; }; constructor(compiler: Compiler); diff --git a/tools/public_api_guard/service-worker/service-worker.d.ts b/tools/public_api_guard/service-worker/service-worker.d.ts index 06a389a790..975f331604 100644 --- a/tools/public_api_guard/service-worker/service-worker.d.ts +++ b/tools/public_api_guard/service-worker/service-worker.d.ts @@ -3,7 +3,7 @@ export declare class ServiceWorkerModule { } export declare class SwPush { - readonly isEnabled: boolean; + get isEnabled(): boolean; readonly messages: Observable; readonly notificationClicks: Observable<{ action: string; @@ -28,7 +28,7 @@ export declare abstract class SwRegistrationOptions { export declare class SwUpdate { readonly activated: Observable; readonly available: Observable; - readonly isEnabled: boolean; + get isEnabled(): boolean; constructor(sw: NgswCommChannel); activateUpdate(): Promise; checkForUpdate(): Promise; diff --git a/tools/ts-api-guardian/package.json b/tools/ts-api-guardian/package.json index 37609adb61..ca6d6795a5 100644 --- a/tools/ts-api-guardian/package.json +++ b/tools/ts-api-guardian/package.json @@ -17,7 +17,7 @@ "test": "test" }, "peerDependencies": { - "typescript": "~3.6.4" + "typescript": "~3.7.4" }, "dependencies": { "chalk": "^2.3.1", @@ -33,7 +33,7 @@ "chai": "^4.1.2", "jasmine": "^3.1.0", "source-map-support": "^0.5.9", - "typescript": "~3.6.4" + "typescript": "~3.7.4" }, "repository": {}, "keywords": [ diff --git a/yarn.lock b/yarn.lock index 94c1dbde6f..80804f8618 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13609,7 +13609,7 @@ typescript@3.2.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.4.tgz#c585cb952912263d915b462726ce244ba510ef3d" integrity sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg== -typescript@3.6.4, typescript@~3.6.4: +typescript@3.6.4: version "3.6.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg== @@ -13619,6 +13619,11 @@ typescript@~3.5.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== +typescript@~3.7.4: + version "3.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.4.tgz#1743a5ec5fef6a1fa9f3e4708e33c81c73876c19" + integrity sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw== + uglify-js@1.2.6, uglify-js@~1.2.5: version "1.2.6" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-1.2.6.tgz#d354b2d3c1cf10ebc18fa78c11a28bdd9ce1580d"