* Fix 33436

* Fix code

* Fix error message after bad merge

* Remove whitespace
This commit is contained in:
Jack Williams authored and GitHub committed 2020-03-12 15:40:14 -07:00
1 parent d727d5a5eb
commit dcc73944f4
96 files changed
+661 -520

No files matched your search

+18 -7
View File
@@ -15218,13 +15218,24 @@ namespace ts {
if (incompatibleStack.length) reportIncompatibleStack();
const [sourceType, targetType] = getTypeNamesForErrorDisplay(source, target);
if (target.flags & TypeFlags.TypeParameter && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) {
reportError(
Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2,
sourceType,
targetType,
typeToString(target.immediateBaseConstraint),
);
if (target.flags & TypeFlags.TypeParameter) {
const constraint = getBaseConstraintOfType(target);
const constraintElab = constraint && isTypeAssignableTo(source, constraint);
if (constraintElab) {
reportError(
Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2,
sourceType,
targetType,
typeToString(constraint!),
);
}
else {
reportError(
Diagnostics._0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1,
targetType,
sourceType
);
}
}
if (!message) {
+4
View File
@@ -3445,6 +3445,10 @@
"category": "Error",
"code": 5081
},
"'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'.": {
"category": "Error",
"code": 5082
},
"Generates a sourcemap for each corresponding '.d.ts' file.": {
"category": "Message",