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);
|
||||
}
|
||||
// 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) {
|
||||
setInputsForProperty(lView, dataValue, attrName, value);
|
||||
if (ngDevMode) {
|
||||
|
|
|
@ -192,7 +192,7 @@ function listenerInternal(
|
|||
// subscribe to directive outputs
|
||||
const outputs = tNode.outputs;
|
||||
let props: PropertyAliasValue|undefined;
|
||||
if (processOutputs && outputs != null && (props = outputs[eventName])) {
|
||||
if (processOutputs && outputs !== null && (props = outputs[eventName])) {
|
||||
const propsLength = props.length;
|
||||
if (propsLength) {
|
||||
const lCleanup = getCleanup(lView);
|
||||
|
|
|
@ -167,8 +167,8 @@ export const TNodeConstructor = class TNode implements ITNode {
|
|||
public attrs: (string|AttributeMarker|(string|SelectorFlags)[])[]|null, //
|
||||
public localNames: (string|number)[]|null, //
|
||||
public initialInputs: (string[]|null)[]|null|undefined, //
|
||||
public inputs: PropertyAliases|null|undefined, //
|
||||
public outputs: PropertyAliases|null|undefined, //
|
||||
public inputs: PropertyAliases|null, //
|
||||
public outputs: PropertyAliases|null, //
|
||||
public tViews: ITView|ITView[]|null, //
|
||||
public next: ITNode|null, //
|
||||
public projectionNext: ITNode|null, //
|
||||
|
|
|
@ -801,8 +801,8 @@ export function createTNode(
|
|||
attrs, // attrs: (string|AttributeMarker|(string|SelectorFlags)[])[]|null
|
||||
null, // localNames: (string|number)[]|null
|
||||
undefined, // initialInputs: (string[]|null)[]|null|undefined
|
||||
undefined, // inputs: PropertyAliases|null|undefined
|
||||
undefined, // outputs: PropertyAliases|null|undefined
|
||||
null, // inputs: PropertyAliases|null
|
||||
null, // outputs: PropertyAliases|null
|
||||
null, // tViews: ITView|ITView[]|null
|
||||
null, // next: ITNode|null
|
||||
null, // projectionNext: ITNode|null
|
||||
|
@ -825,8 +825,8 @@ export function createTNode(
|
|||
attrs: attrs,
|
||||
localNames: null,
|
||||
initialInputs: undefined,
|
||||
inputs: undefined,
|
||||
outputs: undefined,
|
||||
inputs: null,
|
||||
outputs: null,
|
||||
tViews: null,
|
||||
next: null,
|
||||
projectionNext: null,
|
||||
|
|
|
@ -448,20 +448,16 @@ export interface TNode {
|
|||
initialInputs: InitialInputData|null|undefined;
|
||||
|
||||
/**
|
||||
* Input data for all directives 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.
|
||||
* Input data for all directives on this node. `null` means that there are no directives with
|
||||
* inputs on this node.
|
||||
*/
|
||||
inputs: PropertyAliases|null|undefined;
|
||||
inputs: PropertyAliases|null;
|
||||
|
||||
/**
|
||||
* Output data for all directives 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.
|
||||
* Output data for all directives on this node. `null` means that there are no directives with
|
||||
* outputs on this node.
|
||||
*/
|
||||
outputs: PropertyAliases|null|undefined;
|
||||
outputs: PropertyAliases|null;
|
||||
|
||||
/**
|
||||
* The TView or TViews attached to this node.
|
||||
|
|
Loading…
Reference in New Issue