(propNode, containingType, isUncheckedJS)
| 74877 | return getIntersectionType(x); |
| 74878 | } |
| 74879 | function reportNonexistentProperty(propNode, containingType, isUncheckedJS) { |
| 74880 | var errorInfo; |
| 74881 | var relatedInfo; |
| 74882 | if (!ts.isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* TypeFlags.Union */ && !(containingType.flags & 131068 /* TypeFlags.Primitive */)) { |
| 74883 | for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) { |
| 74884 | var subtype = _a[_i]; |
| 74885 | if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) { |
| 74886 | errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(subtype)); |
| 74887 | break; |
| 74888 | } |
| 74889 | } |
| 74890 | } |
| 74891 | if (typeHasStaticProperty(propNode.escapedText, containingType)) { |
| 74892 | var propName = ts.declarationNameToString(propNode); |
| 74893 | var typeName = typeToString(containingType); |
| 74894 | errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_to_access_the_static_member_2_instead, propName, typeName, typeName + "." + propName); |
| 74895 | } |
| 74896 | else { |
| 74897 | var promisedType = getPromisedTypeOfPromise(containingType); |
| 74898 | if (promisedType && getPropertyOfType(promisedType, propNode.escapedText)) { |
| 74899 | errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(containingType)); |
| 74900 | relatedInfo = ts.createDiagnosticForNode(propNode, ts.Diagnostics.Did_you_forget_to_use_await); |
| 74901 | } |
| 74902 | else { |
| 74903 | var missingProperty = ts.declarationNameToString(propNode); |
| 74904 | var container = typeToString(containingType); |
| 74905 | var libSuggestion = getSuggestedLibForNonExistentProperty(missingProperty, containingType); |
| 74906 | if (libSuggestion !== undefined) { |
| 74907 | errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_2_or_later, missingProperty, container, libSuggestion); |
| 74908 | } |
| 74909 | else { |
| 74910 | var suggestion = getSuggestedSymbolForNonexistentProperty(propNode, containingType); |
| 74911 | if (suggestion !== undefined) { |
| 74912 | var suggestedName = ts.symbolName(suggestion); |
| 74913 | var message = isUncheckedJS ? ts.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2 : ts.Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2; |
| 74914 | errorInfo = ts.chainDiagnosticMessages(errorInfo, message, missingProperty, container, suggestedName); |
| 74915 | relatedInfo = suggestion.valueDeclaration && ts.createDiagnosticForNode(suggestion.valueDeclaration, ts.Diagnostics._0_is_declared_here, suggestedName); |
| 74916 | } |
| 74917 | else { |
| 74918 | var diagnostic = containerSeemsToBeEmptyDomElement(containingType) |
| 74919 | ? ts.Diagnostics.Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom |
| 74920 | : ts.Diagnostics.Property_0_does_not_exist_on_type_1; |
| 74921 | errorInfo = ts.chainDiagnosticMessages(elaborateNeverIntersection(errorInfo, containingType), diagnostic, missingProperty, container); |
| 74922 | } |
| 74923 | } |
| 74924 | } |
| 74925 | } |
| 74926 | var resultDiagnostic = ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo); |
| 74927 | if (relatedInfo) { |
| 74928 | ts.addRelatedInfo(resultDiagnostic, relatedInfo); |
| 74929 | } |
| 74930 | addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== ts.Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic); |
| 74931 | } |
| 74932 | function containerSeemsToBeEmptyDomElement(containingType) { |
| 74933 | return (compilerOptions.lib && !compilerOptions.lib.includes("dom")) && |
| 74934 | everyContainedType(containingType, function (type) { return type.symbol && /^(EventTarget|Node|((HTML[a-zA-Z]*)?Element))$/.test(ts.unescapeLeadingUnderscores(type.symbol.escapedName)); }) && |
no test coverage detected