refactor(ivy): stricter TNode.inputs typing (#33798)
TNode.inputs are initialised during directives resolution now so we know early if a node has directives with inputs or no. We don't need to use undefined value as an indicator that inputs were not resolved yet. PR Close #33798
This commit is contained in:
parent
da0c372fdf
commit
e698d355c1
|
@ -1019,7 +1019,7 @@ function i18nAttributesFirstPass(lView: LView, tView: TView, index: number, valu
|
||||||
elementAttributeInternal(previousElementIndex, attrName, value, lView);
|
elementAttributeInternal(previousElementIndex, attrName, value, lView);
|
||||||
}
|
}
|
||||||
// Check if that attribute is a directive input
|
// Check if that attribute is a directive input
|
||||||
const dataValue = tNode.inputs && tNode.inputs[attrName];
|
const dataValue = tNode.inputs !== null && tNode.inputs[attrName];
|
||||||
if (dataValue) {
|
if (dataValue) {
|
||||||
setInputsForProperty(lView, dataValue, attrName, value);
|
setInputsForProperty(lView, dataValue, attrName, value);
|
||||||
if (ngDevMode) {
|
if (ngDevMode) {
|
||||||
|
|
|
@ -192,7 +192,7 @@ function listenerInternal(
|
||||||
// subscribe to directive outputs
|
// subscribe to directive outputs
|
||||||
const outputs = tNode.outputs;
|
const outputs = tNode.outputs;
|
||||||
let props: PropertyAliasValue|undefined;
|
let props: PropertyAliasValue|undefined;
|
||||||
if (processOutputs && outputs != null && (props = outputs[eventName])) {
|
if (processOutputs && outputs !== null && (props = outputs[eventName])) {
|
||||||
const propsLength = props.length;
|
const propsLength = props.length;
|
||||||
if (propsLength) {
|
if (propsLength) {
|
||||||
const lCleanup = getCleanup(lView);
|
const lCleanup = getCleanup(lView);
|
||||||
|
|
|
@ -167,8 +167,8 @@ export const TNodeConstructor = class TNode implements ITNode {
|
||||||
public attrs: (string|AttributeMarker|(string|SelectorFlags)[])[]|null, //
|
public attrs: (string|AttributeMarker|(string|SelectorFlags)[])[]|null, //
|
||||||
public localNames: (string|number)[]|null, //
|
public localNames: (string|number)[]|null, //
|
||||||
public initialInputs: (string[]|null)[]|null|undefined, //
|
public initialInputs: (string[]|null)[]|null|undefined, //
|
||||||
public inputs: PropertyAliases|null|undefined, //
|
public inputs: PropertyAliases|null, //
|
||||||
public outputs: PropertyAliases|null|undefined, //
|
public outputs: PropertyAliases|null, //
|
||||||
public tViews: ITView|ITView[]|null, //
|
public tViews: ITView|ITView[]|null, //
|
||||||
public next: ITNode|null, //
|
public next: ITNode|null, //
|
||||||
public projectionNext: ITNode|null, //
|
public projectionNext: ITNode|null, //
|
||||||
|
|
|
@ -801,8 +801,8 @@ export function createTNode(
|
||||||
attrs, // attrs: (string|AttributeMarker|(string|SelectorFlags)[])[]|null
|
attrs, // attrs: (string|AttributeMarker|(string|SelectorFlags)[])[]|null
|
||||||
null, // localNames: (string|number)[]|null
|
null, // localNames: (string|number)[]|null
|
||||||
undefined, // initialInputs: (string[]|null)[]|null|undefined
|
undefined, // initialInputs: (string[]|null)[]|null|undefined
|
||||||
undefined, // inputs: PropertyAliases|null|undefined
|
null, // inputs: PropertyAliases|null
|
||||||
undefined, // outputs: PropertyAliases|null|undefined
|
null, // outputs: PropertyAliases|null
|
||||||
null, // tViews: ITView|ITView[]|null
|
null, // tViews: ITView|ITView[]|null
|
||||||
null, // next: ITNode|null
|
null, // next: ITNode|null
|
||||||
null, // projectionNext: ITNode|null
|
null, // projectionNext: ITNode|null
|
||||||
|
@ -825,8 +825,8 @@ export function createTNode(
|
||||||
attrs: attrs,
|
attrs: attrs,
|
||||||
localNames: null,
|
localNames: null,
|
||||||
initialInputs: undefined,
|
initialInputs: undefined,
|
||||||
inputs: undefined,
|
inputs: null,
|
||||||
outputs: undefined,
|
outputs: null,
|
||||||
tViews: null,
|
tViews: null,
|
||||||
next: null,
|
next: null,
|
||||||
projectionNext: null,
|
projectionNext: null,
|
||||||
|
|
|
@ -448,20 +448,16 @@ export interface TNode {
|
||||||
initialInputs: InitialInputData|null|undefined;
|
initialInputs: InitialInputData|null|undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input data for all directives on this node.
|
* Input data for all directives on this node. `null` means that there are no directives with
|
||||||
*
|
* inputs on this node.
|
||||||
* - `undefined` means that the prop has not been initialized yet,
|
|
||||||
* - `null` means that the prop has been initialized but no inputs have been found.
|
|
||||||
*/
|
*/
|
||||||
inputs: PropertyAliases|null|undefined;
|
inputs: PropertyAliases|null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output data for all directives on this node.
|
* Output data for all directives on this node. `null` means that there are no directives with
|
||||||
*
|
* outputs on this node.
|
||||||
* - `undefined` means that the prop has not been initialized yet,
|
|
||||||
* - `null` means that the prop has been initialized but no outputs have been found.
|
|
||||||
*/
|
*/
|
||||||
outputs: PropertyAliases|null|undefined;
|
outputs: PropertyAliases|null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The TView or TViews attached to this node.
|
* The TView or TViews attached to this node.
|
||||||
|
|
Loading…
Reference in New Issue