mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 15:45:27 -05:00
@@ -11879,6 +11879,16 @@ namespace ts {
|
||||
function checkJsxAttribute(node: JsxAttribute, elementAttributesType: Type, nameTable: Map<boolean>) {
|
||||
let correspondingPropType: Type = undefined;
|
||||
|
||||
// We need to unconditionally get the expression type
|
||||
let exprType: Type;
|
||||
if (node.initializer) {
|
||||
exprType = checkExpression(node.initializer);
|
||||
}
|
||||
else {
|
||||
// <Elem attr /> is sugar for <Elem attr={true} />
|
||||
exprType = booleanType;
|
||||
}
|
||||
|
||||
// Look up the corresponding property for this attribute
|
||||
if (elementAttributesType === emptyObjectType && isUnhyphenatedJsxName(node.name.text)) {
|
||||
// If there is no 'props' property, you may not have non-"data-" attributes
|
||||
@@ -11902,15 +11912,6 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
let exprType: Type;
|
||||
if (node.initializer) {
|
||||
exprType = checkExpression(node.initializer);
|
||||
}
|
||||
else {
|
||||
// <Elem attr /> is sugar for <Elem attr={true} />
|
||||
exprType = booleanType;
|
||||
}
|
||||
|
||||
if (correspondingPropType) {
|
||||
checkTypeAssignableTo(exprType, correspondingPropType, node);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user