@typescript-deploys/pr-build 5.5.0-pr-58702-7 → 5.5.0-pr-58703-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +14 -0
- package/lib/typescript.js +14 -0
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -59686,6 +59686,9 @@ function createTypeChecker(host) {
|
|
|
59686
59686
|
if (contains(types, wildcardType)) {
|
|
59687
59687
|
return wildcardType;
|
|
59688
59688
|
}
|
|
59689
|
+
if (texts.length === 2 && texts[0] === "" && texts[1] === "" && types[0].flags & 268435456 /* StringMapping */) {
|
|
59690
|
+
return types[0];
|
|
59691
|
+
}
|
|
59689
59692
|
const newTypes = [];
|
|
59690
59693
|
const newTexts = [];
|
|
59691
59694
|
let text = texts[0];
|
|
@@ -66065,6 +66068,13 @@ function createTypeChecker(host) {
|
|
|
66065
66068
|
}
|
|
66066
66069
|
return false;
|
|
66067
66070
|
}
|
|
66071
|
+
function isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(type) {
|
|
66072
|
+
if (!(type.flags & 134217728 /* TemplateLiteral */)) {
|
|
66073
|
+
return false;
|
|
66074
|
+
}
|
|
66075
|
+
const texts = type.texts;
|
|
66076
|
+
return texts.length === 2 && texts[0] === "" && texts[1] === "";
|
|
66077
|
+
}
|
|
66068
66078
|
function isValidTypeForTemplateLiteralPlaceholder(source, target) {
|
|
66069
66079
|
if (target.flags & 2097152 /* Intersection */) {
|
|
66070
66080
|
return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
|
|
@@ -66544,6 +66554,10 @@ function createTypeChecker(host) {
|
|
|
66544
66554
|
}
|
|
66545
66555
|
}
|
|
66546
66556
|
function inferToTemplateLiteralType(source, target) {
|
|
66557
|
+
if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source) && isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(target)) {
|
|
66558
|
+
inferFromTypes(source.types[0], target.types[0]);
|
|
66559
|
+
return;
|
|
66560
|
+
}
|
|
66547
66561
|
const matches = inferTypesFromTemplateLiteralType(source, target);
|
|
66548
66562
|
const types = target.types;
|
|
66549
66563
|
if (matches || every(target.texts, (s) => s.length === 0)) {
|
package/lib/typescript.js
CHANGED
|
@@ -64481,6 +64481,9 @@ function createTypeChecker(host) {
|
|
|
64481
64481
|
if (contains(types, wildcardType)) {
|
|
64482
64482
|
return wildcardType;
|
|
64483
64483
|
}
|
|
64484
|
+
if (texts.length === 2 && texts[0] === "" && texts[1] === "" && types[0].flags & 268435456 /* StringMapping */) {
|
|
64485
|
+
return types[0];
|
|
64486
|
+
}
|
|
64484
64487
|
const newTypes = [];
|
|
64485
64488
|
const newTexts = [];
|
|
64486
64489
|
let text = texts[0];
|
|
@@ -70860,6 +70863,13 @@ function createTypeChecker(host) {
|
|
|
70860
70863
|
}
|
|
70861
70864
|
return false;
|
|
70862
70865
|
}
|
|
70866
|
+
function isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(type) {
|
|
70867
|
+
if (!(type.flags & 134217728 /* TemplateLiteral */)) {
|
|
70868
|
+
return false;
|
|
70869
|
+
}
|
|
70870
|
+
const texts = type.texts;
|
|
70871
|
+
return texts.length === 2 && texts[0] === "" && texts[1] === "";
|
|
70872
|
+
}
|
|
70863
70873
|
function isValidTypeForTemplateLiteralPlaceholder(source, target) {
|
|
70864
70874
|
if (target.flags & 2097152 /* Intersection */) {
|
|
70865
70875
|
return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
|
|
@@ -71339,6 +71349,10 @@ function createTypeChecker(host) {
|
|
|
71339
71349
|
}
|
|
71340
71350
|
}
|
|
71341
71351
|
function inferToTemplateLiteralType(source, target) {
|
|
71352
|
+
if (isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(source) && isTemplateLiteralTypeWithSinglePlaceholderAndNoExtraTexts(target)) {
|
|
71353
|
+
inferFromTypes(source.types[0], target.types[0]);
|
|
71354
|
+
return;
|
|
71355
|
+
}
|
|
71342
71356
|
const matches = inferTypesFromTemplateLiteralType(source, target);
|
|
71343
71357
|
const types = target.types;
|
|
71344
71358
|
if (matches || every(target.texts, (s) => s.length === 0)) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.5.0-pr-
|
|
5
|
+
"version": "5.5.0-pr-58703-2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|