[#4961] Angular v9 (ivy) compatibility fixes #5153 (#5156)

* Angular 9 compatibility: add explicit types to prevent automatic deep imports

If you do not provide an explicit return type to a function then TypeScript
will try to guess it and create a dynamic import type for the `.d.ts` files.

Often the imports incorrectly point to a path deep within a package,
rather than accessing the type via the correct public facing import.

From Angular v9, using ivy, such deep imports cause compilation
errors and will prevent this library from being used for ivy enabled
applications.

This commit fixes this problem for a component and a service that
the adf-core library exports.

* Angular 9 compatibility: import DOCUMENT from `@angular/common`

In Angular 7 importing `DOCUMENT` from `platform-browser` was
deprecated, and it was removed completely in Angular 8.

* fix type afterlast alpha

* fix type after last alpha

* fix types demo shell
This commit is contained in:
Eugenio Romano
2019-10-15 15:22:42 +01:00
committed by Maurizio Vitale
parent a4424d17fc
commit 210f1d8f59
10 changed files with 23 additions and 22 deletions

View File

@@ -16,7 +16,7 @@
*/
import { Injectable } from '@angular/core';
import { NodePaging, QueryBody } from '@alfresco/js-api';
import { NodePaging, QueryBody, ResultSetPaging } from '@alfresco/js-api';
import { Observable, Subject, from, throwError } from 'rxjs';
import { AlfrescoApiService } from './alfresco-api.service';
import { SearchConfigurationService } from './search-configuration.service';
@@ -26,7 +26,7 @@ import { SearchConfigurationService } from './search-configuration.service';
})
export class SearchService {
dataLoaded: Subject<NodePaging> = new Subject();
dataLoaded: Subject<ResultSetPaging> = new Subject();
constructor(private apiService: AlfrescoApiService,
private searchConfigurationService: SearchConfigurationService) {
@@ -55,7 +55,7 @@ export class SearchService {
* @param skipCount Number of higher-ranked items to skip over in the list
* @returns List of search results
*/
search(searchTerm: string, maxResults: number, skipCount: number): Observable<NodePaging> {
search(searchTerm: string, maxResults: number, skipCount: number): Observable<ResultSetPaging> {
const searchQuery = Object.assign(this.searchConfigurationService.generateQueryBody(searchTerm, maxResults, skipCount));
const promise = this.apiService.getInstance().search.searchApi.search(searchQuery);
@@ -71,7 +71,7 @@ export class SearchService {
* @param queryBody Object containing the search parameters
* @returns List of search results
*/
searchByQueryBody(queryBody: QueryBody): Observable<NodePaging> {
searchByQueryBody(queryBody: QueryBody): Observable<ResultSetPaging> {
const promise = this.apiService.getInstance().search.searchApi.search(queryBody);
promise.then((nodePaging: NodePaging) => {