refactor: remove ts2dart annotations
This commit is contained in:
@ -21,7 +21,7 @@ import {OpaqueToken} from './di';
|
||||
* using this token.
|
||||
* @experimental
|
||||
*/
|
||||
export const APP_ID: any = /*@ts2dart_const*/ new OpaqueToken('AppId');
|
||||
export const APP_ID: any = new OpaqueToken('AppId');
|
||||
|
||||
export function _appIdRandomProviderFactory() {
|
||||
return `${_randomChar()}${_randomChar()}${_randomChar()}`;
|
||||
@ -31,12 +31,11 @@ export function _appIdRandomProviderFactory() {
|
||||
* Providers that will generate a random APP_ID_TOKEN.
|
||||
* @experimental
|
||||
*/
|
||||
export const APP_ID_RANDOM_PROVIDER =
|
||||
/*@ts2dart_const*/ /* @ts2dart_Provider */ {
|
||||
provide: APP_ID,
|
||||
useFactory: _appIdRandomProviderFactory,
|
||||
deps: <any[]>[]
|
||||
};
|
||||
export const APP_ID_RANDOM_PROVIDER = {
|
||||
provide: APP_ID,
|
||||
useFactory: _appIdRandomProviderFactory,
|
||||
deps: <any[]>[]
|
||||
};
|
||||
|
||||
function _randomChar(): string {
|
||||
return StringWrapper.fromCharCode(97 + Math.floor(Math.random() * 25));
|
||||
@ -46,19 +45,16 @@ function _randomChar(): string {
|
||||
* A function that will be executed when a platform is initialized.
|
||||
* @experimental
|
||||
*/
|
||||
export const PLATFORM_INITIALIZER: any =
|
||||
/*@ts2dart_const*/ new OpaqueToken('Platform Initializer');
|
||||
export const PLATFORM_INITIALIZER: any = new OpaqueToken('Platform Initializer');
|
||||
|
||||
/**
|
||||
* A function that will be executed when an application is initialized.
|
||||
* @experimental
|
||||
*/
|
||||
export const APP_INITIALIZER: any =
|
||||
/*@ts2dart_const*/ new OpaqueToken('Application Initializer');
|
||||
export const APP_INITIALIZER: any = new OpaqueToken('Application Initializer');
|
||||
|
||||
/**
|
||||
* A token which indicates the root directory of the application
|
||||
* @experimental
|
||||
*/
|
||||
export const PACKAGE_ROOT_URL: any =
|
||||
/*@ts2dart_const*/ new OpaqueToken('Application Packages Root URL');
|
||||
export const PACKAGE_ROOT_URL: any = new OpaqueToken('Application Packages Root URL');
|
||||
|
@ -27,15 +27,13 @@ export {PipeTransform} from './pipe_transform';
|
||||
/**
|
||||
* Structural diffing for `Object`s and `Map`s.
|
||||
*/
|
||||
export const keyValDiff: KeyValueDifferFactory[] =
|
||||
/*@ts2dart_const*/[new DefaultKeyValueDifferFactory()];
|
||||
export const keyValDiff: KeyValueDifferFactory[] = [new DefaultKeyValueDifferFactory()];
|
||||
|
||||
/**
|
||||
* Structural diffing for `Iterable` types such as `Array`s.
|
||||
*/
|
||||
export const iterableDiff: IterableDifferFactory[] =
|
||||
/*@ts2dart_const*/[new DefaultIterableDifferFactory()];
|
||||
export const iterableDiff: IterableDifferFactory[] = [new DefaultIterableDifferFactory()];
|
||||
|
||||
export const defaultIterableDiffers = /*@ts2dart_const*/ new IterableDiffers(iterableDiff);
|
||||
export const defaultIterableDiffers = new IterableDiffers(iterableDiff);
|
||||
|
||||
export const defaultKeyValueDiffers = /*@ts2dart_const*/ new KeyValueDiffers(keyValDiff);
|
||||
export const defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
|
||||
|
@ -14,7 +14,6 @@ import {ChangeDetectorRef} from '../change_detector_ref';
|
||||
import {IterableDiffer, IterableDifferFactory, TrackByFn} from './iterable_differs';
|
||||
|
||||
|
||||
/* @ts2dart_const */
|
||||
export class DefaultIterableDifferFactory implements IterableDifferFactory {
|
||||
constructor() {}
|
||||
supports(obj: Object): boolean { return isListLikeIterable(obj); }
|
||||
|
@ -45,11 +45,9 @@ export interface IterableDifferFactory {
|
||||
|
||||
/**
|
||||
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class IterableDiffers {
|
||||
/*@ts2dart_const*/
|
||||
constructor(public factories: IterableDifferFactory[]) {}
|
||||
|
||||
static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers {
|
||||
|
@ -35,11 +35,9 @@ export interface KeyValueDifferFactory {
|
||||
|
||||
/**
|
||||
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class KeyValueDiffers {
|
||||
/*@ts2dart_const*/
|
||||
constructor(public factories: KeyValueDifferFactory[]) {}
|
||||
|
||||
static create(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers {
|
||||
|
@ -9,8 +9,8 @@
|
||||
import {BaseException, unimplemented} from '../facade/exceptions';
|
||||
import {stringify} from '../facade/lang';
|
||||
|
||||
const _THROW_IF_NOT_FOUND = /*@ts2dart_const*/ new Object();
|
||||
export const THROW_IF_NOT_FOUND = /*@ts2dart_const*/ _THROW_IF_NOT_FOUND;
|
||||
const _THROW_IF_NOT_FOUND = new Object();
|
||||
export const THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
||||
|
||||
class _NullInjector implements Injector {
|
||||
get(token: any, notFoundValue: any = _THROW_IF_NOT_FOUND): any {
|
||||
|
@ -47,7 +47,6 @@ import {stringify} from '../facade/lang';
|
||||
* var injector = Injector.resolveAndCreate([Engine, Car]);
|
||||
* expect(injector.get(Car).engine instanceof Engine).toBe(true);
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class InjectMetadata {
|
||||
@ -75,7 +74,6 @@ export class InjectMetadata {
|
||||
* var injector = Injector.resolveAndCreate([Car]);
|
||||
* expect(injector.get(Car).engine).toBeNull();
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class OptionalMetadata {
|
||||
@ -85,7 +83,6 @@ export class OptionalMetadata {
|
||||
/**
|
||||
* `DependencyMetadata` is used by the framework to extend DI.
|
||||
* This is internal to Angular and should not be used directly.
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class DependencyMetadata {
|
||||
@ -122,7 +119,6 @@ export class DependencyMetadata {
|
||||
* var injector = Injector.resolveAndCreate([NeedsService, UsefulService]);
|
||||
* expect(() => injector.get(NeedsService)).toThrowError();
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class InjectableMetadata {
|
||||
@ -155,7 +151,6 @@ export class InjectableMetadata {
|
||||
* var child = inj.resolveAndCreateChild([NeedsDependency]);
|
||||
* expect(() => child.get(NeedsDependency)).toThrowError();
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class SelfMetadata {
|
||||
@ -186,7 +181,6 @@ export class SelfMetadata {
|
||||
* var inj = Injector.resolveAndCreate([Dependency, NeedsDependency]);
|
||||
* expect(() => inj.get(NeedsDependency)).toThrowError();
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class SkipSelfMetadata {
|
||||
@ -246,7 +240,6 @@ export class SkipSelfMetadata {
|
||||
*
|
||||
* bootstrap(App);
|
||||
*```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class HostMetadata {
|
||||
|
@ -26,7 +26,6 @@
|
||||
*
|
||||
* Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better
|
||||
* error messages.
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class OpaqueToken {
|
||||
|
@ -24,7 +24,6 @@ import {Type, isBlank, isFunction, isType, normalizeBool, stringify} from '../fa
|
||||
*
|
||||
* expect(injector.get("message")).toEqual('Hello');
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @deprecated
|
||||
*/
|
||||
export class Provider {
|
||||
@ -211,7 +210,6 @@ export class Provider {
|
||||
* See {@link Provider} instead.
|
||||
*
|
||||
* @deprecated
|
||||
* @ts2dart_const
|
||||
*/
|
||||
export class Binding extends Provider {
|
||||
constructor(token: any, {toClass, toValue, toAlias, toFactory, deps, multi}: {
|
||||
|
@ -21,7 +21,7 @@ var __unused: Type; // avoid unused import when Type union types are erased
|
||||
|
||||
// Threshold for the dynamic version
|
||||
const _MAX_CONSTRUCTION_COUNTER = 10;
|
||||
const UNDEFINED = /*@ts2dart_const*/ new Object();
|
||||
const UNDEFINED = new Object();
|
||||
|
||||
export interface ReflectiveProtoInjectorStrategy {
|
||||
getProviderAtIndex(index: number): ResolvedReflectiveProvider;
|
||||
@ -629,7 +629,7 @@ export class ReflectiveInjector_ implements ReflectiveInjector {
|
||||
*/
|
||||
debugContext(): any { return this._debugContext(); }
|
||||
|
||||
get(token: any, notFoundValue: any = /*@ts2dart_const*/ THROW_IF_NOT_FOUND): any {
|
||||
get(token: any, notFoundValue: any = THROW_IF_NOT_FOUND): any {
|
||||
return this._getByKey(ReflectiveKey.get(token), null, null, notFoundValue);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ export class ReflectiveDependency {
|
||||
}
|
||||
}
|
||||
|
||||
const _EMPTY_LIST: any[] = /*@ts2dart_const*/[];
|
||||
const _EMPTY_LIST: any[] = [];
|
||||
|
||||
/**
|
||||
* An internal resolved representation of a {@link Provider} used by the {@link Injector}.
|
||||
|
@ -81,7 +81,6 @@ export class ComponentRef_<C> extends ComponentRef<C> {
|
||||
|
||||
/**
|
||||
* @experimental
|
||||
* @ts2dart_const
|
||||
*/
|
||||
const EMPTY_CONTEXT = new Object();
|
||||
|
||||
|
@ -15,7 +15,6 @@ import {DebugAppView} from './view';
|
||||
import {ViewType} from './view_type';
|
||||
|
||||
|
||||
/* @ts2dart_const */
|
||||
export class StaticNodeDebugInfo {
|
||||
constructor(
|
||||
public providerTokens: any[], public componentToken: any,
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {Injector, THROW_IF_NOT_FOUND} from '../di/injector';
|
||||
import {AppView} from './view';
|
||||
|
||||
const _UNDEFINED = /*@ts2dart_const*/ new Object();
|
||||
const _UNDEFINED = new Object();
|
||||
|
||||
export class ElementInjector extends Injector {
|
||||
constructor(private _view: AppView<any>, private _nodeIndex: number) { super(); }
|
||||
|
@ -12,7 +12,7 @@ import {ElementRef} from './element_ref';
|
||||
import {AppView} from './view';
|
||||
import {EmbeddedViewRef} from './view_ref';
|
||||
|
||||
const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object();
|
||||
const EMPTY_CONTEXT = new Object();
|
||||
|
||||
/**
|
||||
* Represents an Embedded Template that can be used to instantiate Embedded Views.
|
||||
|
@ -70,7 +70,7 @@ function _flattenNestedViewRenderNodes(nodes: any[], renderNodes: any[]): any[]
|
||||
return renderNodes;
|
||||
}
|
||||
|
||||
const EMPTY_ARR: any[] = /*@ts2dart_const*/[];
|
||||
const EMPTY_ARR: any[] = [];
|
||||
|
||||
export function ensureSlotCount(projectableNodes: any[][], expectedSlotCount: number): any[][] {
|
||||
var res: any[][];
|
||||
|
@ -63,7 +63,6 @@ export const ANALYZE_FOR_ENTRY_COMPONENTS = new OpaqueToken('AnalyzeForEntryComp
|
||||
* A decorator can inject string literal `text` like so:
|
||||
*
|
||||
* {@example core/ts/metadata/metadata.ts region='attributeMetadata'}
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class AttributeMetadata extends DependencyMetadata {
|
||||
@ -186,7 +185,6 @@ export class AttributeMetadata extends DependencyMetadata {
|
||||
*
|
||||
* The injected object is an unmodifiable live list.
|
||||
* See {@link QueryList} for more details.
|
||||
* @ts2dart_const
|
||||
* @deprecated
|
||||
*/
|
||||
export class QueryMetadata extends DependencyMetadata {
|
||||
@ -256,7 +254,6 @@ export class QueryMetadata extends DependencyMetadata {
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class ContentChildrenMetadata extends QueryMetadata {
|
||||
@ -287,7 +284,6 @@ export class ContentChildrenMetadata extends QueryMetadata {
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class ContentChildMetadata extends QueryMetadata {
|
||||
@ -330,7 +326,6 @@ export class ContentChildMetadata extends QueryMetadata {
|
||||
*
|
||||
* The injected object is an iterable and observable live list.
|
||||
* See {@link QueryList} for more details.
|
||||
* @ts2dart_const
|
||||
* @deprecated
|
||||
*/
|
||||
export class ViewQueryMetadata extends QueryMetadata {
|
||||
@ -423,7 +418,6 @@ export class ViewQueryMetadata extends QueryMetadata {
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class ViewChildrenMetadata extends ViewQueryMetadata {
|
||||
@ -501,7 +495,6 @@ export class ViewChildrenMetadata extends ViewQueryMetadata {
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class ViewChildMetadata extends ViewQueryMetadata {
|
||||
|
@ -408,7 +408,6 @@ export interface DirectiveMetadataType {
|
||||
* Note also that although the `<li></li>` template still exists inside the `<template></template>`,
|
||||
* the instantiated
|
||||
* view occurs on the second `<li></li>` which is a sibling to the `<template>` element.
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class DirectiveMetadata extends InjectableMetadata implements DirectiveMetadataType {
|
||||
@ -824,7 +823,6 @@ export interface ComponentMetadataType extends DirectiveMetadataType {
|
||||
* ### Example
|
||||
*
|
||||
* {@example core/ts/metadata/metadata.ts region='component'}
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class ComponentMetadata extends DirectiveMetadata implements ComponentMetadataType {
|
||||
@ -1095,7 +1093,6 @@ export interface PipeMetadataType {
|
||||
* ### Example
|
||||
*
|
||||
* {@example core/ts/metadata/metadata.ts region='pipe'}
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class PipeMetadata extends InjectableMetadata implements PipeMetadataType {
|
||||
@ -1152,7 +1149,6 @@ export class PipeMetadata extends InjectableMetadata implements PipeMetadataType
|
||||
*
|
||||
* bootstrap(App);
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class InputMetadata {
|
||||
@ -1203,7 +1199,6 @@ export class InputMetadata {
|
||||
* }
|
||||
* bootstrap(App);
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class OutputMetadata {
|
||||
@ -1244,7 +1239,6 @@ export class OutputMetadata {
|
||||
*
|
||||
* bootstrap(App);
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class HostBindingMetadata {
|
||||
@ -1284,7 +1278,6 @@ export class HostBindingMetadata {
|
||||
*
|
||||
* bootstrap(App);
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
* @stable
|
||||
*/
|
||||
export class HostListenerMetadata {
|
||||
|
@ -71,7 +71,6 @@ export var VIEW_ENCAPSULATION_VALUES =
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* @ts2dart_const
|
||||
*
|
||||
* @deprecated Use ComponentMetadata instead.
|
||||
*/
|
||||
|
@ -36,8 +36,7 @@ import {OpaqueToken} from './di';
|
||||
* @deprecated Providing platform directives via a provider is deprecated. Provide platform
|
||||
* directives via an {@link NgModule} instead.
|
||||
*/
|
||||
export const PLATFORM_DIRECTIVES: OpaqueToken =
|
||||
/*@ts2dart_const*/ new OpaqueToken('Platform Directives');
|
||||
export const PLATFORM_DIRECTIVES: OpaqueToken = new OpaqueToken('Platform Directives');
|
||||
|
||||
/**
|
||||
* A token that can be provided when bootstraping an application to make an array of pipes
|
||||
@ -65,4 +64,4 @@ export const PLATFORM_DIRECTIVES: OpaqueToken =
|
||||
* @deprecated Providing platform pipes via a provider is deprecated. Provide platform pipes via an
|
||||
* {@link NgModule} instead.
|
||||
*/
|
||||
export const PLATFORM_PIPES: OpaqueToken = /*@ts2dart_const*/ new OpaqueToken('Platform Pipes');
|
||||
export const PLATFORM_PIPES: OpaqueToken = new OpaqueToken('Platform Pipes');
|
||||
|
@ -11,12 +11,10 @@ import {WtfScopeFn, createScope, detectWTF, endTimeRange, leave, startTimeRange}
|
||||
export {WtfScopeFn} from './wtf_impl';
|
||||
|
||||
|
||||
// Change exports to const once https://github.com/angular/ts2dart/issues/150
|
||||
|
||||
/**
|
||||
* True if WTF is enabled.
|
||||
*/
|
||||
export var wtfEnabled = detectWTF();
|
||||
export const wtfEnabled = detectWTF();
|
||||
|
||||
function noopScope(arg0?: any, arg1?: any): any {
|
||||
return null;
|
||||
|
@ -148,7 +148,6 @@ export interface GetTestability {
|
||||
Testability;
|
||||
}
|
||||
|
||||
/* @ts2dart_const */
|
||||
class _NoopGetTestability implements GetTestability {
|
||||
addToWindow(registry: TestabilityRegistry): void {}
|
||||
findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean):
|
||||
@ -165,4 +164,4 @@ export function setTestabilityGetter(getter: GetTestability): void {
|
||||
_testabilityGetter = getter;
|
||||
}
|
||||
|
||||
var _testabilityGetter: GetTestability = /*@ts2dart_const*/ new _NoopGetTestability();
|
||||
var _testabilityGetter: GetTestability = new _NoopGetTestability();
|
||||
|
Reference in New Issue
Block a user