fix(ivy): remove metadata from *Def and introduce *DefWithMeta types (#26203)
Previously in Ivy, metadata for directives/components/modules/etc was carried in .d.ts files inside type information encoded on the DirectiveDef, ComponentDef, NgModuleDef, etc types of Ivy definition fields. This works well, but has the side effect of complicating Ivy's runtime code as these extra generic type parameters had to be specified as <any> throughout the codebase. *DefInternal types were introduced previously to mitigate this issue, but that's the wrong way to solve the problem. This commit returns *Def types to their original form, with no metadata attached. Instead, new *DefWithMeta types are introduced that alias the plain definition types and add extra generic parameters. This way the only code that needs to deal with the extra metadata parameters is the compiler code that reads and writes them - the existence of this metadata is transparent to the runtime, as it should be. PR Close #26203
This commit is contained in:

committed by
Jason Aden

parent
b0070dfb9a
commit
79466baef8
@ -100,9 +100,11 @@ export {
|
||||
pipe as ɵpipe,
|
||||
BaseDef as ɵBaseDef,
|
||||
ComponentDef as ɵComponentDef,
|
||||
ComponentDefInternal as ɵComponentDefInternal,
|
||||
ComponentDefWithMeta as ɵComponentDefWithMeta,
|
||||
DirectiveDef as ɵDirectiveDef,
|
||||
DirectiveDefWithMeta as ɵDirectiveDefWithMeta,
|
||||
PipeDef as ɵPipeDef,
|
||||
PipeDefWithMeta as ɵPipeDefWithMeta,
|
||||
whenRendered as ɵwhenRendered,
|
||||
i18nApply as ɵi18nApply,
|
||||
i18nExpMapping as ɵi18nExpMapping,
|
||||
@ -134,7 +136,7 @@ export {
|
||||
|
||||
export {
|
||||
NgModuleDef as ɵNgModuleDef,
|
||||
NgModuleDefInternal as ɵNgModuleDefInternal,
|
||||
NgModuleDefWithMeta as ɵNgModuleDefWithMeta,
|
||||
NgModuleTransitiveScopes as ɵNgModuleTransitiveScopes,
|
||||
} from './metadata/ng_module';
|
||||
|
||||
|
@ -26,11 +26,7 @@ export interface NgModuleTransitiveScopes {
|
||||
exported: {directives: Set<any>; pipes: Set<any>;};
|
||||
}
|
||||
|
||||
/**
|
||||
* A version of {@link NgModuleDef} that represents the runtime type shape only, and excludes
|
||||
* metadata parameters.
|
||||
*/
|
||||
export type NgModuleDefInternal<T> = NgModuleDef<T, any, any, any>;
|
||||
export type NgModuleDefWithMeta<T, Declarations, Imports, Exports> = NgModuleDef<T>;
|
||||
|
||||
/**
|
||||
* Runtime link information for NgModules.
|
||||
@ -42,7 +38,7 @@ export type NgModuleDefInternal<T> = NgModuleDef<T, any, any, any>;
|
||||
* never create the object directly since the shape of this object
|
||||
* can change between versions.
|
||||
*/
|
||||
export interface NgModuleDef<T, Declarations, Imports, Exports> {
|
||||
export interface NgModuleDef<T> {
|
||||
/** Token representing the module. Used by DI. */
|
||||
type: T;
|
||||
|
||||
|
@ -19,7 +19,7 @@ import {queueInitHooks, queueLifecycleHooks} from './hooks';
|
||||
import {PlayerHandler} from './interfaces/player';
|
||||
|
||||
import {CLEAN_PROMISE, baseDirectiveCreate, createLViewData, createTView, detectChangesInternal, enterView, executeInitAndContentHooks, hostElement, leaveView, locateHostElement, setHostBindings, queueHostBindingForCheck,} from './instructions';
|
||||
import {ComponentDef, ComponentDefInternal, ComponentType} from './interfaces/definition';
|
||||
import {ComponentDef, ComponentType} from './interfaces/definition';
|
||||
import {LElementNode} from './interfaces/node';
|
||||
import {RElement, RendererFactory3, domRendererFactory3} from './interfaces/renderer';
|
||||
import {CONTEXT, INJECTOR, LViewData, LViewFlags, RootContext, RootContextFlags, TVIEW} from './interfaces/view';
|
||||
@ -77,7 +77,7 @@ export interface CreateComponentOptions {
|
||||
}
|
||||
|
||||
/** See CreateComponentOptions.hostFeatures */
|
||||
type HostFeature = (<T>(component: T, componentDef: ComponentDef<T, string>) => void);
|
||||
type HostFeature = (<T>(component: T, componentDef: ComponentDef<T>) => void);
|
||||
|
||||
// TODO: A hack to not pull in the NullInjector from @angular/core.
|
||||
export const NULL_INJECTOR: Injector = {
|
||||
@ -149,7 +149,7 @@ export function renderComponent<T>(
|
||||
* renderComponent() and ViewContainerRef.createComponent().
|
||||
*/
|
||||
export function createRootComponent<T>(
|
||||
elementNode: LElementNode, componentDef: ComponentDef<T, string>, rootView: LViewData,
|
||||
elementNode: LElementNode, componentDef: ComponentDef<T>, rootView: LViewData,
|
||||
rootContext: RootContext, hostFeatures: HostFeature[] | null): any {
|
||||
// Create directive instance with factory() and store at index 0 in directives array
|
||||
const component = baseDirectiveCreate(0, componentDef.factory() as T, componentDef, elementNode);
|
||||
@ -188,7 +188,7 @@ export function createRootContext(
|
||||
* renderComponent(AppComponent, {features: [RootLifecycleHooks]});
|
||||
* ```
|
||||
*/
|
||||
export function LifecycleHooksFeature(component: any, def: ComponentDefInternal<any>): void {
|
||||
export function LifecycleHooksFeature(component: any, def: ComponentDef<any>): void {
|
||||
const rootTView = readPatchedLViewData(component) ![TVIEW];
|
||||
|
||||
// Root component is always created at dir index 0
|
||||
|
@ -20,7 +20,7 @@ import {assertComponentType, assertDefined} from './assert';
|
||||
import {LifecycleHooksFeature, createRootComponent, createRootContext} from './component';
|
||||
import {getComponentDef} from './definition';
|
||||
import {adjustBlueprintForNewNode, createLViewData, createNodeAtIndex, createTView, elementCreate, enterView, getTNode, hostElement, locateHostElement, renderEmbeddedTemplate} from './instructions';
|
||||
import {ComponentDefInternal, RenderFlags} from './interfaces/definition';
|
||||
import {ComponentDef, RenderFlags} from './interfaces/definition';
|
||||
import {LElementNode, TElementNode, TNode, TNodeType, TViewNode} from './interfaces/node';
|
||||
import {RElement, RendererFactory3, domRendererFactory3} from './interfaces/renderer';
|
||||
import {FLAGS, INJECTOR, LViewData, LViewFlags, RootContext, TVIEW} from './interfaces/view';
|
||||
@ -88,7 +88,7 @@ export class ComponentFactory<T> extends viewEngine_ComponentFactory<T> {
|
||||
return toRefArray(this.componentDef.outputs);
|
||||
}
|
||||
|
||||
constructor(private componentDef: ComponentDefInternal<any>) {
|
||||
constructor(private componentDef: ComponentDef<any>) {
|
||||
super();
|
||||
this.componentType = componentDef.type;
|
||||
this.selector = componentDef.selectors[0][0] as string;
|
||||
|
@ -10,12 +10,12 @@ import './ng_dev_mode';
|
||||
|
||||
import {ChangeDetectionStrategy} from '../change_detection/constants';
|
||||
import {Provider} from '../di/provider';
|
||||
import {NgModuleDef, NgModuleDefInternal} from '../metadata/ng_module';
|
||||
import {NgModuleDef} from '../metadata/ng_module';
|
||||
import {ViewEncapsulation} from '../metadata/view';
|
||||
import {Type} from '../type';
|
||||
|
||||
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF, NG_MODULE_DEF, NG_PIPE_DEF} from './fields';
|
||||
import {BaseDef, ComponentDefFeature, ComponentDefInternal, ComponentQuery, ComponentTemplate, ComponentType, DirectiveDefFeature, DirectiveDefInternal, DirectiveType, DirectiveTypesOrFactory, PipeDefInternal, PipeType, PipeTypesOrFactory} from './interfaces/definition';
|
||||
import {BaseDef, ComponentDef, ComponentDefFeature, ComponentQuery, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFeature, DirectiveType, DirectiveTypesOrFactory, PipeDef, PipeType, PipeTypesOrFactory} from './interfaces/definition';
|
||||
import {CssSelectorList, SelectorFlags} from './interfaces/projection';
|
||||
|
||||
export const EMPTY: {} = {};
|
||||
@ -280,7 +280,7 @@ export function defineComponent<T>(componentDefinition: {
|
||||
if (animations) {
|
||||
data.animations = animations;
|
||||
}
|
||||
const def: ComponentDefInternal<any> = {
|
||||
const def: ComponentDef<any> = {
|
||||
type: type,
|
||||
diPublic: null,
|
||||
consts: componentDefinition.consts,
|
||||
@ -328,7 +328,7 @@ export function defineComponent<T>(componentDefinition: {
|
||||
}
|
||||
|
||||
export function extractDirectiveDef(type: DirectiveType<any>& ComponentType<any>):
|
||||
DirectiveDefInternal<any>|ComponentDefInternal<any> {
|
||||
DirectiveDef<any>|ComponentDef<any> {
|
||||
const def = getComponentDef(type) || getDirectiveDef(type);
|
||||
if (ngDevMode && !def) {
|
||||
throw new Error(`'${type.name}' is neither 'ComponentType' or 'DirectiveType'.`);
|
||||
@ -336,7 +336,7 @@ export function extractDirectiveDef(type: DirectiveType<any>& ComponentType<any>
|
||||
return def !;
|
||||
}
|
||||
|
||||
export function extractPipeDef(type: PipeType<any>): PipeDefInternal<any> {
|
||||
export function extractPipeDef(type: PipeType<any>): PipeDef<any> {
|
||||
const def = getPipeDef(type);
|
||||
if (ngDevMode && !def) {
|
||||
throw new Error(`'${type.name}' is not a 'PipeType'.`);
|
||||
@ -344,8 +344,8 @@ export function extractPipeDef(type: PipeType<any>): PipeDefInternal<any> {
|
||||
return def !;
|
||||
}
|
||||
|
||||
export function defineNgModule<T>(def: {type: T} & Partial<NgModuleDef<T, any, any, any>>): never {
|
||||
const res: NgModuleDefInternal<T> = {
|
||||
export function defineNgModule<T>(def: {type: T} & Partial<NgModuleDef<T>>): never {
|
||||
const res: NgModuleDef<T> = {
|
||||
type: def.type,
|
||||
bootstrap: def.bootstrap || EMPTY_ARRAY,
|
||||
declarations: def.declarations || EMPTY_ARRAY,
|
||||
@ -656,7 +656,7 @@ export function definePipe<T>(pipeDef: {
|
||||
/** Whether the pipe is pure. */
|
||||
pure?: boolean
|
||||
}): never {
|
||||
return (<PipeDefInternal<T>>{
|
||||
return (<PipeDef<T>>{
|
||||
name: pipeDef.name,
|
||||
factory: pipeDef.factory,
|
||||
pure: pipeDef.pure !== false,
|
||||
@ -670,18 +670,18 @@ export function definePipe<T>(pipeDef: {
|
||||
* explicit. This would require some sort of migration strategy.
|
||||
*/
|
||||
|
||||
export function getComponentDef<T>(type: any): ComponentDefInternal<T>|null {
|
||||
export function getComponentDef<T>(type: any): ComponentDef<T>|null {
|
||||
return (type as any)[NG_COMPONENT_DEF] || null;
|
||||
}
|
||||
|
||||
export function getDirectiveDef<T>(type: any): DirectiveDefInternal<T>|null {
|
||||
export function getDirectiveDef<T>(type: any): DirectiveDef<T>|null {
|
||||
return (type as any)[NG_DIRECTIVE_DEF] || null;
|
||||
}
|
||||
|
||||
export function getPipeDef<T>(type: any): PipeDefInternal<T>|null {
|
||||
export function getPipeDef<T>(type: any): PipeDef<T>|null {
|
||||
return (type as any)[NG_PIPE_DEF] || null;
|
||||
}
|
||||
|
||||
export function getNgModuleDef<T>(type: any): NgModuleDefInternal<T>|null {
|
||||
export function getNgModuleDef<T>(type: any): NgModuleDef<T>|null {
|
||||
return (type as any)[NG_MODULE_DEF] || null;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import {assertDefined} from './assert';
|
||||
import {getComponentDef, getDirectiveDef, getPipeDef} from './definition';
|
||||
import {NG_ELEMENT_ID} from './fields';
|
||||
import {_getViewData, assertPreviousIsParent, getPreviousOrParentTNode, resolveDirective, setEnvironment} from './instructions';
|
||||
import {DirectiveDefInternal} from './interfaces/definition';
|
||||
import {DirectiveDef} from './interfaces/definition';
|
||||
import {INJECTOR_SIZE, InjectorLocationFlags, PARENT_INJECTOR, TNODE,} from './interfaces/injector';
|
||||
import {AttributeMarker, TContainerNode, TElementContainerNode, TElementNode, TNode, TNodeFlags, TNodeType} from './interfaces/node';
|
||||
import {isProceduralRenderer} from './interfaces/renderer';
|
||||
@ -196,7 +196,7 @@ export function getParentInjectorView(location: number, startView: LViewData): L
|
||||
* @param def The definition of the directive to be made public
|
||||
*/
|
||||
export function diPublicInInjector(
|
||||
injectorIndex: number, view: LViewData, def: DirectiveDefInternal<any>): void {
|
||||
injectorIndex: number, view: LViewData, def: DirectiveDef<any>): void {
|
||||
bloomAdd(injectorIndex, view[TVIEW], def.type);
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ export function diPublicInInjector(
|
||||
*
|
||||
* @param def The definition of the directive to be made public
|
||||
*/
|
||||
export function diPublic(def: DirectiveDefInternal<any>): void {
|
||||
export function diPublic(def: DirectiveDef<any>): void {
|
||||
diPublicInInjector(getOrCreateNodeInjector(), _getViewData(), def);
|
||||
}
|
||||
|
||||
@ -399,7 +399,7 @@ function searchMatchesQueuedForCreation<T>(token: any, hostTView: TView): T|null
|
||||
const matches = hostTView.currentMatches;
|
||||
if (matches) {
|
||||
for (let i = 0; i < matches.length; i += 2) {
|
||||
const def = matches[i] as DirectiveDefInternal<any>;
|
||||
const def = matches[i] as DirectiveDef<any>;
|
||||
if (def.type === token) {
|
||||
return resolveDirective(def, i + 1, matches, hostTView);
|
||||
}
|
||||
@ -422,7 +422,7 @@ function searchDirectivesOnInjector<T>(
|
||||
for (let i = start; i < end; i++) {
|
||||
// Get the definition for the directive at this index and, if it is injectable (diPublic),
|
||||
// and matches the given token, return the directive instance.
|
||||
const directiveDef = defs[i] as DirectiveDefInternal<any>;
|
||||
const directiveDef = defs[i] as DirectiveDef<any>;
|
||||
if (directiveDef.type === token && directiveDef.diPublic) {
|
||||
return injectorView[DIRECTIVES] ![i];
|
||||
}
|
||||
|
@ -9,22 +9,22 @@
|
||||
import {Type} from '../../type';
|
||||
import {fillProperties} from '../../util/property';
|
||||
import {EMPTY, EMPTY_ARRAY} from '../definition';
|
||||
import {ComponentDefInternal, ComponentTemplate, DirectiveDefFeature, DirectiveDefInternal, RenderFlags} from '../interfaces/definition';
|
||||
import {ComponentDef, ComponentTemplate, DirectiveDef, DirectiveDefFeature, RenderFlags} from '../interfaces/definition';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Determines if a definition is a {@link ComponentDefInternal} or a {@link DirectiveDefInternal}
|
||||
* Determines if a definition is a {@link ComponentDef} or a {@link DirectiveDef}
|
||||
* @param definition The definition to examine
|
||||
*/
|
||||
function isComponentDef<T>(definition: ComponentDefInternal<T>| DirectiveDefInternal<T>):
|
||||
definition is ComponentDefInternal<T> {
|
||||
const def = definition as ComponentDefInternal<T>;
|
||||
function isComponentDef<T>(definition: ComponentDef<T>| DirectiveDef<T>):
|
||||
definition is ComponentDef<T> {
|
||||
const def = definition as ComponentDef<T>;
|
||||
return typeof def.template === 'function';
|
||||
}
|
||||
|
||||
function getSuperType(type: Type<any>): Type<any>&
|
||||
{ngComponentDef?: ComponentDefInternal<any>, ngDirectiveDef?: DirectiveDefInternal<any>} {
|
||||
{ngComponentDef?: ComponentDef<any>, ngDirectiveDef?: DirectiveDef<any>} {
|
||||
return Object.getPrototypeOf(type.prototype).constructor;
|
||||
}
|
||||
|
||||
@ -32,12 +32,11 @@ function getSuperType(type: Type<any>): Type<any>&
|
||||
* Merges the definition from a super class to a sub class.
|
||||
* @param definition The definition that is a SubClass of another directive of component
|
||||
*/
|
||||
export function InheritDefinitionFeature(
|
||||
definition: DirectiveDefInternal<any>| ComponentDefInternal<any>): void {
|
||||
export function InheritDefinitionFeature(definition: DirectiveDef<any>| ComponentDef<any>): void {
|
||||
let superType = getSuperType(definition.type);
|
||||
|
||||
while (superType) {
|
||||
let superDef: DirectiveDefInternal<any>|ComponentDefInternal<any>|undefined = undefined;
|
||||
let superDef: DirectiveDef<any>|ComponentDef<any>|undefined = undefined;
|
||||
if (isComponentDef(definition)) {
|
||||
// Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
|
||||
superDef = superType.ngComponentDef || superType.ngDirectiveDef;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {SimpleChange} from '../../change_detection/change_detection_util';
|
||||
import {OnChanges, SimpleChanges} from '../../metadata/lifecycle_hooks';
|
||||
import {DirectiveDefInternal} from '../interfaces/definition';
|
||||
import {DirectiveDef} from '../interfaces/definition';
|
||||
|
||||
const PRIVATE_PREFIX = '__ngOnChanges_';
|
||||
|
||||
@ -38,7 +38,7 @@ type OnChangesExpando = OnChanges & {
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
export function NgOnChangesFeature<T>(definition: DirectiveDefInternal<T>): void {
|
||||
export function NgOnChangesFeature<T>(definition: DirectiveDef<T>): void {
|
||||
const declaredToMinifiedInputs = definition.declaredInputs;
|
||||
const proto = definition.type.prototype;
|
||||
for (const declaredName in declaredToMinifiedInputs) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {diPublic} from '../di';
|
||||
import {DirectiveDefInternal} from '../interfaces/definition';
|
||||
import {DirectiveDef} from '../interfaces/definition';
|
||||
|
||||
/**
|
||||
* This feature publishes the directive (or component) into the DI system, making it visible to
|
||||
@ -14,6 +14,6 @@ import {DirectiveDefInternal} from '../interfaces/definition';
|
||||
*
|
||||
* @param definition
|
||||
*/
|
||||
export function PublicFeature<T>(definition: DirectiveDefInternal<T>) {
|
||||
export function PublicFeature<T>(definition: DirectiveDef<T>) {
|
||||
definition.diPublic = diPublic;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {assertEqual} from './assert';
|
||||
import {DirectiveDefInternal} from './interfaces/definition';
|
||||
import {DirectiveDef} from './interfaces/definition';
|
||||
import {TNodeFlags} from './interfaces/node';
|
||||
import {DIRECTIVES, FLAGS, HookData, LViewData, LViewFlags, TView} from './interfaces/view';
|
||||
|
||||
@ -52,7 +52,7 @@ export function queueLifecycleHooks(flags: number, tView: TView): void {
|
||||
// directiveCreate) so we can preserve the current hook order. Content, view, and destroy
|
||||
// hooks for projected components and directives must be called *before* their hosts.
|
||||
for (let i = start; i < end; i++) {
|
||||
const def: DirectiveDefInternal<any> = tView.directives ![i];
|
||||
const def: DirectiveDef<any> = tView.directives ![i];
|
||||
queueContentHooks(def, tView, i);
|
||||
queueViewHooks(def, tView, i);
|
||||
queueDestroyHooks(def, tView, i);
|
||||
@ -61,7 +61,7 @@ export function queueLifecycleHooks(flags: number, tView: TView): void {
|
||||
}
|
||||
|
||||
/** Queues afterContentInit and afterContentChecked hooks on TView */
|
||||
function queueContentHooks(def: DirectiveDefInternal<any>, tView: TView, i: number): void {
|
||||
function queueContentHooks(def: DirectiveDef<any>, tView: TView, i: number): void {
|
||||
if (def.afterContentInit) {
|
||||
(tView.contentHooks || (tView.contentHooks = [])).push(i, def.afterContentInit);
|
||||
}
|
||||
@ -73,7 +73,7 @@ function queueContentHooks(def: DirectiveDefInternal<any>, tView: TView, i: numb
|
||||
}
|
||||
|
||||
/** Queues afterViewInit and afterViewChecked hooks on TView */
|
||||
function queueViewHooks(def: DirectiveDefInternal<any>, tView: TView, i: number): void {
|
||||
function queueViewHooks(def: DirectiveDef<any>, tView: TView, i: number): void {
|
||||
if (def.afterViewInit) {
|
||||
(tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewInit);
|
||||
}
|
||||
@ -85,7 +85,7 @@ function queueViewHooks(def: DirectiveDefInternal<any>, tView: TView, i: number)
|
||||
}
|
||||
|
||||
/** Queues onDestroy hooks on TView */
|
||||
function queueDestroyHooks(def: DirectiveDefInternal<any>, tView: TView, i: number): void {
|
||||
function queueDestroyHooks(def: DirectiveDef<any>, tView: TView, i: number): void {
|
||||
if (def.onDestroy != null) {
|
||||
(tView.destroyHooks || (tView.destroyHooks = [])).push(i, def.onDestroy);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import {defineBase, defineComponent, defineDirective, defineNgModule, definePipe
|
||||
import {InheritDefinitionFeature} from './features/inherit_definition_feature';
|
||||
import {NgOnChangesFeature} from './features/ng_onchanges_feature';
|
||||
import {PublicFeature} from './features/public_feature';
|
||||
import {BaseDef, ComponentDef, ComponentDefInternal, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFlags, DirectiveDefInternal, DirectiveType, PipeDef} from './interfaces/definition';
|
||||
import {BaseDef, ComponentDef, ComponentDefWithMeta, ComponentTemplate, ComponentType, DirectiveDef, DirectiveDefFlags, DirectiveDefWithMeta, DirectiveType, PipeDef, PipeDefWithMeta} from './interfaces/definition';
|
||||
|
||||
export {ComponentFactory, ComponentFactoryResolver, ComponentRef, WRAP_RENDERER_FACTORY2, injectComponentFactoryResolver} from './component_ref';
|
||||
export {directiveInject, getFactoryOf, getInheritedFactory, injectAttribute, injectRenderer2} from './di';
|
||||
@ -149,17 +149,18 @@ export {templateRefExtractor} from './view_engine_compatibility_prebound';
|
||||
export {
|
||||
BaseDef,
|
||||
ComponentDef,
|
||||
ComponentDefInternal,
|
||||
ComponentDefWithMeta,
|
||||
ComponentTemplate,
|
||||
ComponentType,
|
||||
DirectiveDef,
|
||||
DirectiveDefFlags,
|
||||
DirectiveDefInternal,
|
||||
DirectiveDefWithMeta,
|
||||
DirectiveType,
|
||||
NgOnChangesFeature,
|
||||
InheritDefinitionFeature,
|
||||
PublicFeature,
|
||||
PipeDef,
|
||||
PipeDefWithMeta,
|
||||
LifecycleHooksFeature,
|
||||
defineComponent,
|
||||
defineDirective,
|
||||
|
@ -18,7 +18,7 @@ import {getRootView} from './discovery_utils';
|
||||
import {throwCyclicDependencyError, throwErrorIfNoChangesMode, throwMultipleComponentError} from './errors';
|
||||
import {executeHooks, executeInitHooks, queueInitHooks, queueLifecycleHooks} from './hooks';
|
||||
import {ACTIVE_INDEX, LContainer, RENDER_PARENT, VIEWS} from './interfaces/container';
|
||||
import {ComponentDefInternal, ComponentQuery, ComponentTemplate, DirectiveDefInternal, DirectiveDefListOrFactory, InitialStylingFlags, PipeDefListOrFactory, RenderFlags} from './interfaces/definition';
|
||||
import {ComponentDef, ComponentQuery, ComponentTemplate, DirectiveDef, DirectiveDefListOrFactory, InitialStylingFlags, PipeDefListOrFactory, RenderFlags} from './interfaces/definition';
|
||||
import {AttributeMarker, InitialInputData, InitialInputs, LContainerNode, LElementContainerNode, LElementNode, LNode, LProjectionNode, LTextNode, LViewNode, LocalRefExtractor, PropertyAliasValue, PropertyAliases, TAttributes, TContainerNode, TElementContainerNode, TElementNode, TNode, TNodeFlags, TNodeType, TProjectionNode, TViewNode} from './interfaces/node';
|
||||
import {CssSelectorList, NG_PROJECT_AS_ATTR_NAME} from './interfaces/projection';
|
||||
import {LQueries} from './interfaces/query';
|
||||
@ -363,7 +363,7 @@ export function setHostBindings(bindings: number[] | null): void {
|
||||
const defs = tView.directives !;
|
||||
for (let i = 0; i < bindings.length; i += 2) {
|
||||
const dirIndex = bindings[i];
|
||||
const def = defs[dirIndex] as DirectiveDefInternal<any>;
|
||||
const def = defs[dirIndex] as DirectiveDef<any>;
|
||||
if (firstTemplatePass) {
|
||||
for (let i = 0; i < def.hostVars; i++) {
|
||||
tView.blueprint.push(NO_CHANGE);
|
||||
@ -906,7 +906,7 @@ function cacheMatchingDirectivesForNode(
|
||||
const matches = tView.currentMatches = findDirectiveMatches(tNode);
|
||||
if (matches) {
|
||||
for (let i = 0; i < matches.length; i += 2) {
|
||||
const def = matches[i] as DirectiveDefInternal<any>;
|
||||
const def = matches[i] as DirectiveDef<any>;
|
||||
const valueIndex = i + 1;
|
||||
resolveDirective(def, valueIndex, matches, tView);
|
||||
saveNameToExportMap(matches[valueIndex] as number, def, exportsMap);
|
||||
@ -924,9 +924,9 @@ function findDirectiveMatches(tNode: TNode): CurrentMatchesList|null {
|
||||
const def = registry[i];
|
||||
if (isNodeMatchingSelectorList(tNode, def.selectors !)) {
|
||||
matches || (matches = []);
|
||||
if ((def as ComponentDefInternal<any>).template) {
|
||||
if ((def as ComponentDef<any>).template) {
|
||||
if (tNode.flags & TNodeFlags.isComponent) throwMultipleComponentError(tNode);
|
||||
addComponentLogic(def as ComponentDefInternal<any>);
|
||||
addComponentLogic(def as ComponentDef<any>);
|
||||
tNode.flags = TNodeFlags.isComponent;
|
||||
|
||||
// The component is always stored first with directives after.
|
||||
@ -942,8 +942,7 @@ function findDirectiveMatches(tNode: TNode): CurrentMatchesList|null {
|
||||
}
|
||||
|
||||
export function resolveDirective(
|
||||
def: DirectiveDefInternal<any>, valueIndex: number, matches: CurrentMatchesList,
|
||||
tView: TView): any {
|
||||
def: DirectiveDef<any>, valueIndex: number, matches: CurrentMatchesList, tView: TView): any {
|
||||
if (matches[valueIndex] === null) {
|
||||
matches[valueIndex] = CIRCULAR;
|
||||
const instance = def.factory();
|
||||
@ -993,12 +992,12 @@ function instantiateDirectivesDirectly() {
|
||||
const tDirectives = tView.directives !;
|
||||
|
||||
for (let i = start; i < end; i++) {
|
||||
const def: DirectiveDefInternal<any> = tDirectives[i];
|
||||
const def: DirectiveDef<any> = tDirectives[i];
|
||||
|
||||
// Component view must be set on node before the factory is created so
|
||||
// ChangeDetectorRefs have a way to store component view on creation.
|
||||
if ((def as ComponentDefInternal<any>).template) {
|
||||
addComponentLogic(def as ComponentDefInternal<any>);
|
||||
if ((def as ComponentDef<any>).template) {
|
||||
addComponentLogic(def as ComponentDef<any>);
|
||||
}
|
||||
directiveCreate(i, def.factory(), def);
|
||||
}
|
||||
@ -1027,11 +1026,11 @@ function cacheMatchingLocalNames(
|
||||
* to their directive instances.
|
||||
*/
|
||||
function saveNameToExportMap(
|
||||
index: number, def: DirectiveDefInternal<any>| ComponentDefInternal<any>,
|
||||
index: number, def: DirectiveDef<any>| ComponentDef<any>,
|
||||
exportsMap: {[key: string]: number} | null) {
|
||||
if (exportsMap) {
|
||||
if (def.exportAs) exportsMap[def.exportAs] = index;
|
||||
if ((def as ComponentDefInternal<any>).template) exportsMap[''] = index;
|
||||
if ((def as ComponentDef<any>).template) exportsMap[''] = index;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1212,7 +1211,7 @@ export function locateHostElement(
|
||||
* @returns LElementNode created
|
||||
*/
|
||||
export function hostElement(
|
||||
tag: string, rNode: RElement | null, def: ComponentDefInternal<any>,
|
||||
tag: string, rNode: RElement | null, def: ComponentDef<any>,
|
||||
sanitizer?: Sanitizer | null): LElementNode {
|
||||
resetComponentState();
|
||||
const tNode = createNodeAtIndex(
|
||||
@ -1522,7 +1521,7 @@ function generatePropertyAliases(
|
||||
const defs = tView.directives !;
|
||||
|
||||
for (let i = start; i < end; i++) {
|
||||
const directiveDef = defs[i] as DirectiveDefInternal<any>;
|
||||
const directiveDef = defs[i] as DirectiveDef<any>;
|
||||
const propertyAliasMap: {[publicName: string]: string} =
|
||||
isInput ? directiveDef.inputs : directiveDef.outputs;
|
||||
for (let publicName in propertyAliasMap) {
|
||||
@ -1763,12 +1762,11 @@ export function textBinding<T>(index: number, value: T | NO_CHANGE): void {
|
||||
* @param directiveDef DirectiveDef object which contains information about the template.
|
||||
*/
|
||||
export function directiveCreate<T>(
|
||||
directiveDefIdx: number, directive: T,
|
||||
directiveDef: DirectiveDefInternal<T>| ComponentDefInternal<T>): T {
|
||||
directiveDefIdx: number, directive: T, directiveDef: DirectiveDef<T>| ComponentDef<T>): T {
|
||||
const hostNode = getLNode(previousOrParentTNode, viewData);
|
||||
const instance = baseDirectiveCreate(directiveDefIdx, directive, directiveDef, hostNode);
|
||||
|
||||
if ((directiveDef as ComponentDefInternal<T>).template) {
|
||||
if ((directiveDef as ComponentDef<T>).template) {
|
||||
hostNode.data ![CONTEXT] = directive;
|
||||
}
|
||||
|
||||
@ -1792,7 +1790,7 @@ export function directiveCreate<T>(
|
||||
return instance;
|
||||
}
|
||||
|
||||
function addComponentLogic<T>(def: ComponentDefInternal<T>): void {
|
||||
function addComponentLogic<T>(def: ComponentDef<T>): void {
|
||||
const hostNode = getLNode(previousOrParentTNode, viewData);
|
||||
|
||||
const tView = getOrCreateTView(
|
||||
@ -1821,7 +1819,7 @@ function addComponentLogic<T>(def: ComponentDefInternal<T>): void {
|
||||
* current Angular. Example: local refs and inputs on root component.
|
||||
*/
|
||||
export function baseDirectiveCreate<T>(
|
||||
index: number, directive: T, directiveDef: DirectiveDefInternal<T>| ComponentDefInternal<T>,
|
||||
index: number, directive: T, directiveDef: DirectiveDef<T>| ComponentDef<T>,
|
||||
hostNode: LNode): T {
|
||||
ngDevMode && assertEqual(
|
||||
viewData[BINDING_INDEX], tView.bindingStartIndex,
|
||||
|
@ -59,11 +59,9 @@ export const enum DirectiveDefFlags {ContentQuery = 0b10}
|
||||
*/
|
||||
export interface PipeType<T> extends Type<T> { ngPipeDef: never; }
|
||||
|
||||
/**
|
||||
* A version of {@link DirectiveDef} that represents the runtime type shape only, and excludes
|
||||
* metadata parameters.
|
||||
*/
|
||||
export type DirectiveDefInternal<T> = DirectiveDef<T, string>;
|
||||
export type DirectiveDefWithMeta<
|
||||
T, Selector extends string, ExportAs extends string, InputMap extends{[key: string]: string},
|
||||
OutputMap extends{[key: string]: string}, QueryFields extends string[]> = DirectiveDef<T>;
|
||||
|
||||
/**
|
||||
* Runtime information for classes that are inherited by components or directives
|
||||
@ -110,12 +108,12 @@ export interface BaseDef<T> {
|
||||
*
|
||||
* See: {@link defineDirective}
|
||||
*/
|
||||
export interface DirectiveDef<T, Selector extends string> extends BaseDef<T> {
|
||||
export interface DirectiveDef<T> extends BaseDef<T> {
|
||||
/** Token representing the directive. Used by DI. */
|
||||
type: Type<T>;
|
||||
|
||||
/** Function that makes a directive public to the DI system. */
|
||||
diPublic: ((def: DirectiveDef<T, string>) => void)|null;
|
||||
diPublic: ((def: DirectiveDef<T>) => void)|null;
|
||||
|
||||
/** The selectors that will be used to match nodes to this directive. */
|
||||
selectors: CssSelectorList;
|
||||
@ -172,11 +170,9 @@ export interface DirectiveDef<T, Selector extends string> extends BaseDef<T> {
|
||||
features: DirectiveDefFeature[]|null;
|
||||
}
|
||||
|
||||
/**
|
||||
* A version of {@link ComponentDef} that represents the runtime type shape only, and excludes
|
||||
* metadata parameters.
|
||||
*/
|
||||
export type ComponentDefInternal<T> = ComponentDef<T, string>;
|
||||
export type ComponentDefWithMeta<
|
||||
T, Selector extends String, ExportAs extends string, InputMap extends{[key: string]: string},
|
||||
OutputMap extends{[key: string]: string}, QueryFields extends string[]> = ComponentDef<T>;
|
||||
|
||||
/**
|
||||
* Runtime link information for Components.
|
||||
@ -190,7 +186,7 @@ export type ComponentDefInternal<T> = ComponentDef<T, string>;
|
||||
*
|
||||
* See: {@link defineComponent}
|
||||
*/
|
||||
export interface ComponentDef<T, Selector extends string> extends DirectiveDef<T, Selector> {
|
||||
export interface ComponentDef<T> extends DirectiveDef<T> {
|
||||
/**
|
||||
* Runtime unique component ID.
|
||||
*/
|
||||
@ -289,13 +285,13 @@ export interface ComponentDef<T, Selector extends string> extends DirectiveDef<T
|
||||
*
|
||||
* See: {@link definePipe}
|
||||
*/
|
||||
export interface PipeDef<T, S extends string> {
|
||||
export interface PipeDef<T> {
|
||||
/**
|
||||
* Pipe name.
|
||||
*
|
||||
* Used to resolve pipe in templates.
|
||||
*/
|
||||
name: S;
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Factory function used to create a new pipe instance.
|
||||
@ -314,10 +310,10 @@ export interface PipeDef<T, S extends string> {
|
||||
onDestroy: (() => void)|null;
|
||||
}
|
||||
|
||||
export type PipeDefInternal<T> = PipeDef<T, string>;
|
||||
export type PipeDefWithMeta<T, Name extends string> = PipeDef<T>;
|
||||
|
||||
export type DirectiveDefFeature = <T>(directiveDef: DirectiveDef<T, string>) => void;
|
||||
export type ComponentDefFeature = <T>(componentDef: ComponentDef<T, string>) => void;
|
||||
export type DirectiveDefFeature = <T>(directiveDef: DirectiveDef<T>) => void;
|
||||
export type ComponentDefFeature = <T>(componentDef: ComponentDef<T>) => void;
|
||||
|
||||
/**
|
||||
* Type used for directiveDefs on component definition.
|
||||
@ -326,12 +322,12 @@ export type ComponentDefFeature = <T>(componentDef: ComponentDef<T, string>) =>
|
||||
*/
|
||||
export type DirectiveDefListOrFactory = (() => DirectiveDefList) | DirectiveDefList;
|
||||
|
||||
export type DirectiveDefList = (DirectiveDef<any, string>| ComponentDef<any, string>)[];
|
||||
export type DirectiveDefList = (DirectiveDef<any>| ComponentDef<any>)[];
|
||||
|
||||
export type DirectiveTypesOrFactory = (() => DirectiveTypeList) | DirectiveTypeList;
|
||||
|
||||
export type DirectiveTypeList =
|
||||
(DirectiveDef<any, string>| ComponentDef<any, string>|
|
||||
(DirectiveDef<any>| ComponentDef<any>|
|
||||
Type<any>/* Type as workaround for: Microsoft/TypeScript/issues/4881 */)[];
|
||||
|
||||
/**
|
||||
@ -341,13 +337,12 @@ export type DirectiveTypeList =
|
||||
*/
|
||||
export type PipeDefListOrFactory = (() => PipeDefList) | PipeDefList;
|
||||
|
||||
export type PipeDefList = PipeDefInternal<any>[];
|
||||
export type PipeDefList = PipeDef<any>[];
|
||||
|
||||
export type PipeTypesOrFactory = (() => DirectiveTypeList) | DirectiveTypeList;
|
||||
|
||||
export type PipeTypeList =
|
||||
(PipeDefInternal<any>|
|
||||
Type<any>/* Type as workaround for: Microsoft/TypeScript/issues/4881 */)[];
|
||||
(PipeDef<any>| Type<any>/* Type as workaround for: Microsoft/TypeScript/issues/4881 */)[];
|
||||
|
||||
|
||||
// Note: This hack is necessary so we don't erroneously get a circular dependency
|
||||
|
@ -12,7 +12,7 @@ import {Sanitizer} from '../../sanitization/security';
|
||||
import {PlayerHandler} from '../interfaces/player';
|
||||
|
||||
import {LContainer} from './container';
|
||||
import {ComponentQuery, ComponentTemplate, DirectiveDefInternal, DirectiveDefList, PipeDefInternal, PipeDefList} from './definition';
|
||||
import {ComponentQuery, ComponentTemplate, DirectiveDef, DirectiveDefList, PipeDef, PipeDefList} from './definition';
|
||||
import {LElementNode, LViewNode, TElementNode, TNode, TViewNode} from './node';
|
||||
import {LQueries} from './query';
|
||||
import {Renderer3} from './renderer';
|
||||
@ -558,10 +558,10 @@ export type HookData = (number | (() => void))[];
|
||||
*
|
||||
* Injector bloom filters are also stored here.
|
||||
*/
|
||||
export type TData = (TNode | PipeDefInternal<any>| number | null)[];
|
||||
export type TData = (TNode | PipeDef<any>| number | null)[];
|
||||
|
||||
/** Type for TView.currentMatches */
|
||||
export type CurrentMatchesList = [DirectiveDefInternal<any>, (string | number | null)];
|
||||
export type CurrentMatchesList = [DirectiveDef<any>, (string | number | null)];
|
||||
|
||||
// Note: This hack is necessary so we don't erroneously get a circular dependency
|
||||
// failure based on types.
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
import {Expression, R3InjectorMetadata, R3NgModuleMetadata, R3Reference, WrappedNodeExpr, compileInjector, compileNgModule as compileR3NgModule, jitExpression} from '@angular/compiler';
|
||||
|
||||
import {ModuleWithProviders, NgModule, NgModuleDefInternal, NgModuleTransitiveScopes} from '../../metadata/ng_module';
|
||||
import {ModuleWithProviders, NgModule, NgModuleDef, NgModuleTransitiveScopes} from '../../metadata/ng_module';
|
||||
import {Type} from '../../type';
|
||||
import {getComponentDef, getDirectiveDef, getNgModuleDef, getPipeDef} from '../definition';
|
||||
import {NG_COMPONENT_DEF, NG_DIRECTIVE_DEF, NG_INJECTOR_DEF, NG_MODULE_DEF, NG_PIPE_DEF} from '../fields';
|
||||
import {ComponentDefInternal} from '../interfaces/definition';
|
||||
import {ComponentDef} from '../interfaces/definition';
|
||||
|
||||
import {angularCoreEnv} from './environment';
|
||||
import {reflectDependencies} from './util';
|
||||
@ -100,7 +100,7 @@ function setScopeOnDeclaredComponents(moduleType: Type<any>, ngModule: NgModule)
|
||||
declarations.forEach(declaration => {
|
||||
if (declaration.hasOwnProperty(NG_COMPONENT_DEF)) {
|
||||
// An `ngComponentDef` field exists - go ahead and patch the component directly.
|
||||
const component = declaration as Type<any>& {ngComponentDef: ComponentDefInternal<any>};
|
||||
const component = declaration as Type<any>& {ngComponentDef: ComponentDef<any>};
|
||||
const componentDef = getComponentDef(component) !;
|
||||
patchComponentDefWithScope(componentDef, transitiveScopes);
|
||||
} else if (
|
||||
@ -116,7 +116,7 @@ function setScopeOnDeclaredComponents(moduleType: Type<any>, ngModule: NgModule)
|
||||
* a given module.
|
||||
*/
|
||||
export function patchComponentDefWithScope<C>(
|
||||
componentDef: ComponentDefInternal<C>, transitiveScopes: NgModuleTransitiveScopes) {
|
||||
componentDef: ComponentDef<C>, transitiveScopes: NgModuleTransitiveScopes) {
|
||||
componentDef.directiveDefs = () => Array.from(transitiveScopes.compilation.directives)
|
||||
.map(dir => getDirectiveDef(dir) || getComponentDef(dir) !)
|
||||
.filter(def => !!def);
|
||||
@ -168,7 +168,7 @@ export function transitiveScopesFor<T>(moduleType: Type<T>): NgModuleTransitiveS
|
||||
def.imports.forEach(<I>(imported: Type<I>) => {
|
||||
const importedTyped = imported as Type<I>& {
|
||||
// If imported is an @NgModule:
|
||||
ngModuleDef?: NgModuleDefInternal<I>;
|
||||
ngModuleDef?: NgModuleDef<I>;
|
||||
};
|
||||
|
||||
if (!isNgModule<I>(importedTyped)) {
|
||||
@ -187,7 +187,7 @@ export function transitiveScopesFor<T>(moduleType: Type<T>): NgModuleTransitiveS
|
||||
// Components, Directives, NgModules, and Pipes can all be exported.
|
||||
ngComponentDef?: any;
|
||||
ngDirectiveDef?: any;
|
||||
ngModuleDef?: NgModuleDefInternal<E>;
|
||||
ngModuleDef?: NgModuleDef<E>;
|
||||
ngPipeDef?: any;
|
||||
};
|
||||
|
||||
@ -248,6 +248,6 @@ function isModuleWithProviders(value: any): value is ModuleWithProviders<{}> {
|
||||
return (value as{ngModule?: any}).ngModule !== undefined;
|
||||
}
|
||||
|
||||
function isNgModule<T>(value: Type<T>): value is Type<T>&{ngModuleDef: NgModuleDefInternal<T>} {
|
||||
function isNgModule<T>(value: Type<T>): value is Type<T>&{ngModuleDef: NgModuleDef<T>} {
|
||||
return !!getNgModuleDef(value);
|
||||
}
|
||||
|
@ -11,14 +11,14 @@ import {StaticProvider} from '../di/provider';
|
||||
import {createInjector} from '../di/r3_injector';
|
||||
import {ComponentFactoryResolver as viewEngine_ComponentFactoryResolver} from '../linker/component_factory_resolver';
|
||||
import {InternalNgModuleRef, NgModuleFactory as viewEngine_NgModuleFactory, NgModuleRef as viewEngine_NgModuleRef} from '../linker/ng_module_factory';
|
||||
import {NgModuleDefInternal} from '../metadata/ng_module';
|
||||
import {NgModuleDef} from '../metadata/ng_module';
|
||||
import {Type} from '../type';
|
||||
import {stringify} from '../util';
|
||||
import {assertDefined} from './assert';
|
||||
import {ComponentFactoryResolver} from './component_ref';
|
||||
import {getNgModuleDef} from './definition';
|
||||
|
||||
export interface NgModuleType { ngModuleDef: NgModuleDefInternal<any>; }
|
||||
export interface NgModuleType { ngModuleDef: NgModuleDef<any>; }
|
||||
|
||||
export const COMPONENT_FACTORY_RESOLVER: StaticProvider = {
|
||||
provide: viewEngine_ComponentFactoryResolver,
|
||||
|
@ -9,7 +9,7 @@
|
||||
import {PipeTransform} from '../change_detection/pipe_transform';
|
||||
|
||||
import {getTView, load, store} from './instructions';
|
||||
import {PipeDefInternal, PipeDefList} from './interfaces/definition';
|
||||
import {PipeDef, PipeDefList} from './interfaces/definition';
|
||||
import {HEADER_OFFSET} from './interfaces/view';
|
||||
import {pureFunction1, pureFunction2, pureFunction3, pureFunction4, pureFunctionV} from './pure_function';
|
||||
|
||||
@ -22,7 +22,7 @@ import {pureFunction1, pureFunction2, pureFunction3, pureFunction4, pureFunction
|
||||
*/
|
||||
export function pipe(index: number, pipeName: string): any {
|
||||
const tView = getTView();
|
||||
let pipeDef: PipeDefInternal<any>;
|
||||
let pipeDef: PipeDef<any>;
|
||||
const adjustedIndex = index + HEADER_OFFSET;
|
||||
|
||||
if (tView.firstTemplatePass) {
|
||||
@ -33,7 +33,7 @@ export function pipe(index: number, pipeName: string): any {
|
||||
])).push(adjustedIndex, pipeDef.onDestroy);
|
||||
}
|
||||
} else {
|
||||
pipeDef = tView.data[adjustedIndex] as PipeDefInternal<any>;
|
||||
pipeDef = tView.data[adjustedIndex] as PipeDef<any>;
|
||||
}
|
||||
|
||||
const pipeInstance = pipeDef.factory();
|
||||
@ -49,7 +49,7 @@ export function pipe(index: number, pipeName: string): any {
|
||||
* @param registry Full list of available pipes
|
||||
* @returns Matching PipeDef
|
||||
*/
|
||||
function getPipeDef(name: string, registry: PipeDefList | null): PipeDefInternal<any> {
|
||||
function getPipeDef(name: string, registry: PipeDefList | null): PipeDef<any> {
|
||||
if (registry) {
|
||||
for (let i = 0; i < registry.length; i++) {
|
||||
const pipeDef = registry[i];
|
||||
@ -151,5 +151,5 @@ export function pipeBindV(index: number, slotOffset: number, values: any[]): any
|
||||
}
|
||||
|
||||
function isPure(index: number): boolean {
|
||||
return (<PipeDefInternal<any>>getTView().data[index + HEADER_OFFSET]).pure;
|
||||
return (<PipeDef<any>>getTView().data[index + HEADER_OFFSET]).pure;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import {getSymbolIterator} from '../util';
|
||||
import {assertDefined, assertEqual} from './assert';
|
||||
import {NG_ELEMENT_ID} from './fields';
|
||||
import {_getViewData, assertPreviousIsParent, getOrCreateCurrentQueries, store, storeCleanupWithContext} from './instructions';
|
||||
import {DirectiveDefInternal, unusedValueExportToPlacateAjd as unused1} from './interfaces/definition';
|
||||
import {DirectiveDef, unusedValueExportToPlacateAjd as unused1} from './interfaces/definition';
|
||||
import {unusedValueExportToPlacateAjd as unused2} from './interfaces/injector';
|
||||
import {TContainerNode, TElementContainerNode, TElementNode, TNode, TNodeFlags, TNodeType, unusedValueExportToPlacateAjd as unused3} from './interfaces/node';
|
||||
import {LQueries, QueryReadType, unusedValueExportToPlacateAjd as unused4} from './interfaces/query';
|
||||
@ -258,7 +258,7 @@ function getIdxOfMatchingDirective(tNode: TNode, currentView: LViewData, type: T
|
||||
const start = flags >> TNodeFlags.DirectiveStartingIndexShift;
|
||||
const end = start + count;
|
||||
for (let i = start; i < end; i++) {
|
||||
const def = defs[i] as DirectiveDefInternal<any>;
|
||||
const def = defs[i] as DirectiveDef<any>;
|
||||
if (def.type === type && def.diPublic) {
|
||||
return i;
|
||||
}
|
||||
|
Reference in New Issue
Block a user