feat: typescript 2.9 support (#24652)

PR Close #24652
This commit is contained in:
Igor Minar
2018-06-25 11:11:22 +02:00
committed by Miško Hevery
parent 0c3738a780
commit e3064d5432
38 changed files with 293 additions and 204 deletions

View File

@ -28,5 +28,5 @@ export {_sanitizeUrl as ɵ_sanitizeUrl} from './sanitization/url_sanitizer';
export {global as ɵglobal, looseIdentical as ɵlooseIdentical, stringify as ɵstringify} from './util';
export {makeDecorator as ɵmakeDecorator} from './util/decorators';
export {isObservable as ɵisObservable, isPromise as ɵisPromise} from './util/lang';
export {clearOverrides as ɵclearOverrides, overrideComponentView as ɵoverrideComponentView, overrideProvider as ɵoverrideProvider} from './view/index';
export {clearOverrides as ɵclearOverrides, initServicesIfNeeded as ɵinitServicesIfNeeded, overrideComponentView as ɵoverrideComponentView, overrideProvider as ɵoverrideProvider} from './view/index';
export {NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR} from './view/provider';

View File

@ -209,7 +209,7 @@ export function defineComponent<T>(componentDefinition: {
const type = componentDefinition.type;
const pipeTypes = componentDefinition.pipes !;
const directiveTypes = componentDefinition.directives !;
const declaredInputs: {[P in keyof T]: P} = {} as any;
const declaredInputs: {[key: string]: string} = {} as any;
const def: ComponentDefInternal<any> = {
type: type,
diPublic: null,

View File

@ -1525,7 +1525,7 @@ export function baseDirectiveCreate<T>(
* @param tNode The static data for this node
*/
function setInputsFromAttrs<T>(
directiveIndex: number, instance: T, inputs: {[key: string]: string}, tNode: TNode): void {
directiveIndex: number, instance: T, inputs: {[P in keyof T]: string;}, tNode: TNode): void {
let initialInputData = tNode.initialInputs as InitialInputData | undefined;
if (initialInputData === undefined || directiveIndex >= initialInputData.length) {
initialInputData = generateInitialInputs(directiveIndex, inputs, tNode);

View File

@ -84,7 +84,7 @@ export interface DirectiveDef<T, Selector extends string> {
type: Type<T>;
/** Function that makes a directive public to the DI system. */
diPublic: ((def: DirectiveDef<any, string>) => void)|null;
diPublic: ((def: DirectiveDef<T, string>) => void)|null;
/** The selectors that will be used to match nodes to this directive. */
selectors: CssSelectorList;
@ -94,7 +94,7 @@ export interface DirectiveDef<T, Selector extends string> {
* are their aliases if any, or their original unminified property names
* (as in `@Input('alias') propertyName: any;`).
*/
readonly inputs: {[P in keyof T]: P};
readonly inputs: {[P in keyof T]: string};
/**
* @deprecated This is only here because `NgOnChanges` incorrectly uses declared name instead of

View File

@ -6,10 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
// Import zero symbols from zone.js. This causes the zone ambient type to be
// added to the type-checker, without emitting any runtime module load statement
import {} from 'zone.js';
// TODO(jteplitz602): Load WorkerGlobalScope from lib.webworker.d.ts file #3492
declare var WorkerGlobalScope: any /** TODO #9100 */;
// CommonJS / Node have global context exposed as "global" variable.

View File

@ -6,9 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
// Import zero symbols from zone.js. This causes the zone ambient type to be
// added to the type-checker, without emitting any runtime module load statement
import {} from 'zone.js';
import {EventEmitter} from '../event_emitter';
/**