typescript 4.2.0-dev.20210209 → 4.2.3

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.
@@ -74,239 +74,6 @@ declare namespace Intl {
74
74
  */
75
75
  type RelativeTimeFormatStyle = "long" | "short" | "narrow";
76
76
 
77
- /**
78
- * Unicode Calendar Identifier
79
- *
80
- * [Reference](http://unicode.org/reports/tr35/#UnicodeCalendarIdentifier)
81
- *
82
- * [Source](https://github.com/unicode-org/cldr/blob/b805d0b/common/bcp47/calendar.xml)
83
- */
84
- type Calendar =
85
- // Thai Buddhist calendar
86
- | "buddhist"
87
- // Traditional Chinese calendar
88
- | "chinese"
89
- // Coptic calendar
90
- | "coptic"
91
- // Traditional Korean calendar
92
- | "dangi"
93
- // Ethiopic calendar, Amete Alem (epoch approx. 5493 B.C.E)
94
- | "ethiopic-amete-alem" | "ethioaa"
95
- // Ethiopic calendar, Amete Mihret (epoch approx, 8 C.E.)
96
- | "ethiopic"
97
- // Gregorian calendar
98
- | "gregorian"
99
- // Gregorian calendar (alias)
100
- | "gregory"
101
- // Traditional Hebrew calendar
102
- | "hebrew"
103
- // Indian calendar
104
- | "indian"
105
- // Islamic calendar
106
- | "islamic"
107
- // Islamic calendar, Umm al-Qura
108
- | "islamic-umalqura"
109
- // Islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - astronomical epoch)
110
- | "islamic-tbla"
111
- // Islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - civil epoch)
112
- | "islamic-civil"
113
- | "islamicc" // Deprecated alias
114
- // Islamic calendar, Saudi Arabia sighting
115
- | "islamic-rgsa"
116
- // ISO calendar (Gregorian calendar using the ISO 8601 calendar week rules)
117
- | "iso8601"
118
- // Japanese Imperial calendar
119
- | "japanese"
120
- // Persian calendar
121
- | "persian"
122
- // Republic of China calendar
123
- | "roc"
124
- ;
125
-
126
- /**
127
- * Unicode Number System Identifier
128
- *
129
- * [Reference](http://unicode.org/reports/tr35/#UnicodeNumberSystemIdentifier)
130
- *
131
- * [Source](https://github.com/unicode-org/cldr/blob/be7a953/common/bcp47/number.xml)
132
- */
133
- type NumberingSystem =
134
- // Adlam digits
135
- | "adlm"
136
- // Ahom digits
137
- | "ahom"
138
- // Arabic-Indic digits
139
- | "arab"
140
- // Extended Arabic-Indic digits
141
- | "arabext"
142
- // Armenian upper case numerals — algorithmic
143
- | "armn"
144
- // Armenian lower case numerals — algorithmic
145
- | "armnlow"
146
- // Balinese digits
147
- | "bali"
148
- // Bengali digits
149
- | "beng"
150
- // Bhaiksuki digits
151
- | "bhks"
152
- // Brahmi digits
153
- | "brah"
154
- // Chakma digits
155
- | "cakm"
156
- // Cham digits
157
- | "cham"
158
- // Cyrillic numerals — algorithmic
159
- | "cyrl"
160
- // Devanagari digits
161
- | "deva"
162
- // Dives Akuru digits
163
- | "diak"
164
- // Ethiopic numerals — algorithmic
165
- | "ethi"
166
- // Financial numerals — may be algorithmic
167
- | "finance"
168
- // Full width digits
169
- | "fullwide"
170
- // Georgian numerals — algorithmic
171
- | "geor"
172
- // Gunjala Gondi digits
173
- | "gong"
174
- // Masaram Gondi digits
175
- | "gonm"
176
- // Greek upper case numerals — algorithmic
177
- | "grek"
178
- // Greek lower case numerals — algorithmic
179
- | "greklow"
180
- // Gujarati digits
181
- | "gujr"
182
- // Gurmukhi digits
183
- | "guru"
184
- // Han-character day-of-month numbering for lunar/other traditional calendars"
185
- | "hanidays"
186
- // Positional decimal system using Chinese number ideographs as digits
187
- | "hanidec"
188
- // Simplified Chinese numerals — algorithmic
189
- | "hans"
190
- // Simplified Chinese financial numerals — algorithmic
191
- | "hansfin"
192
- // Traditional Chinese numerals — algorithmic
193
- | "hant"
194
- // Traditional Chinese financial numerals — algorithmic
195
- | "hantfin"
196
- // Hebrew numerals — algorithmic
197
- | "hebr"
198
- // Pahawh Hmong digits
199
- | "hmng"
200
- // Nyiakeng Puachue Hmong digits
201
- | "hmnp"
202
- // Javanese digits
203
- | "java"
204
- // Japanese numerals — algorithmic
205
- | "jpan"
206
- // Japanese financial numerals — algorithmic
207
- | "jpanfin"
208
- // Japanese first-year Gannen numbering for Japanese calendar
209
- | "jpanyear"
210
- // Kayah Li digits
211
- | "kali"
212
- // Khmer digits
213
- | "khmr"
214
- // Kannada digits
215
- | "knda"
216
- // Tai Tham Hora (secular) digits
217
- | "lana"
218
- // Tai Tham Tham (ecclesiastical) digits
219
- | "lanatham"
220
- // Lao digits
221
- | "laoo"
222
- // Latin digits
223
- | "latn"
224
- // Lepcha digits
225
- | "lepc"
226
- // Limbu digits
227
- | "limb"
228
- // Mathematical bold digits
229
- | "mathbold"
230
- // Mathematical double-struck digits
231
- | "mathdbl"
232
- // Mathematical monospace digits
233
- | "mathmono"
234
- // Mathematical sans-serif bold digits
235
- | "mathsanb"
236
- // Mathematical sans-serif digits
237
- | "mathsans"
238
- // Malayalam digits
239
- | "mlym"
240
- // Modi digits
241
- | "modi"
242
- // Mongolian digits
243
- | "mong"
244
- // Mro digits
245
- | "mroo"
246
- // Meetei Mayek digits
247
- | "mtei"
248
- // Myanmar digits
249
- | "mymr"
250
- // Myanmar Shan digits
251
- | "mymrshan"
252
- // Myanmar Tai Laing digits
253
- | "mymrtlng"
254
- // Native digits
255
- | "native"
256
- // Newa digits
257
- | "newa"
258
- // N'Ko digits
259
- | "nkoo"
260
- // Ol Chiki digits
261
- | "olck"
262
- // Oriya digits
263
- | "orya"
264
- // Osmanya digits
265
- | "osma"
266
- // Hanifi Rohingya digits
267
- | "rohg"
268
- // Roman upper case numerals — algorithmic
269
- | "roman"
270
- // Roman lowercase numerals — algorithmic
271
- | "romanlow"
272
- // Saurashtra digits
273
- | "saur"
274
- // Sharada digits
275
- | "shrd"
276
- // Khudawadi digits
277
- | "sind"
278
- // Sinhala Lith digits
279
- | "sinh"
280
- // Sora_Sompeng digits
281
- | "sora"
282
- // Sundanese digits
283
- | "sund"
284
- // Takri digits
285
- | "takr"
286
- // New Tai Lue digits
287
- | "talu"
288
- // Tamil numerals — algorithmic
289
- | "taml"
290
- // Modern Tamil decimal digits
291
- | "tamldec"
292
- // Telugu digits
293
- | "telu"
294
- // Thai digits
295
- | "thai"
296
- // Tirhuta digits
297
- | "tirh"
298
- // Tibetan digits
299
- | "tibt"
300
- // Traditional numerals — may be algorithmic
301
- | "traditional" | "traditio"
302
- // Vai digits
303
- | "vaii"
304
- // Warang Citi digits
305
- | "wara"
306
- // Wancho digits
307
- | "wcho"
308
- ;
309
-
310
77
  /**
311
78
  * An object with some or all of properties of `options` parameter
312
79
  * of `Intl.RelativeTimeFormat` constructor.
@@ -534,9 +301,9 @@ declare namespace Intl {
534
301
  interface DateTimeFormatOptions {
535
302
  dateStyle?: "full" | "long" | "medium" | "short";
536
303
  timeStyle?: "full" | "long" | "medium" | "short";
537
- calendar?: Calendar;
304
+ calendar?: string;
538
305
  dayPeriod?: "narrow" | "short" | "long";
539
- numberingSystem?: NumberingSystem;
306
+ numberingSystem?: string;
540
307
  hourCycle?: "h11" | "h12" | "h23" | "h24";
541
308
  fractionalSecondDigits?: 0 | 1 | 2 | 3;
542
309
  }
package/lib/protocol.d.ts CHANGED
@@ -603,6 +603,41 @@ declare namespace ts.server.protocol {
603
603
  */
604
604
  body?: string[];
605
605
  }
606
+ /**
607
+ * A request to get encoded semantic classifications for a span in the file
608
+ */
609
+ interface EncodedSemanticClassificationsRequest extends FileRequest {
610
+ arguments: EncodedSemanticClassificationsRequestArgs;
611
+ }
612
+ /**
613
+ * Arguments for EncodedSemanticClassificationsRequest request.
614
+ */
615
+ interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs {
616
+ /**
617
+ * Start position of the span.
618
+ */
619
+ start: number;
620
+ /**
621
+ * Length of the span.
622
+ */
623
+ length: number;
624
+ /**
625
+ * Optional parameter for the semantic highlighting response, if absent it
626
+ * defaults to "original".
627
+ */
628
+ format?: "original" | "2020";
629
+ }
630
+ /** The response for a EncodedSemanticClassificationsRequest */
631
+ interface EncodedSemanticClassificationsResponse extends Response {
632
+ body?: EncodedSemanticClassificationsResponseBody;
633
+ }
634
+ /**
635
+ * Implementation response message. Gives series of text spans depending on the format ar.
636
+ */
637
+ interface EncodedSemanticClassificationsResponseBody {
638
+ endOfLineState: EndOfLineState;
639
+ spans: number[];
640
+ }
606
641
  /**
607
642
  * Arguments in document highlight request; include: filesToSearch, file,
608
643
  * line, offset.
@@ -2626,6 +2661,33 @@ declare namespace ts.server.protocol {
2626
2661
  ES2020 = "ES2020",
2627
2662
  ESNext = "ESNext"
2628
2663
  }
2664
+ const enum ClassificationType {
2665
+ comment = 1,
2666
+ identifier = 2,
2667
+ keyword = 3,
2668
+ numericLiteral = 4,
2669
+ operator = 5,
2670
+ stringLiteral = 6,
2671
+ regularExpressionLiteral = 7,
2672
+ whiteSpace = 8,
2673
+ text = 9,
2674
+ punctuation = 10,
2675
+ className = 11,
2676
+ enumName = 12,
2677
+ interfaceName = 13,
2678
+ moduleName = 14,
2679
+ typeParameterName = 15,
2680
+ typeAliasName = 16,
2681
+ parameterName = 17,
2682
+ docCommentTagName = 18,
2683
+ jsxOpenTagName = 19,
2684
+ jsxCloseTagName = 20,
2685
+ jsxSelfClosingTagName = 21,
2686
+ jsxAttribute = 22,
2687
+ jsxText = 23,
2688
+ jsxAttributeStringLiteralValue = 24,
2689
+ bigintLiteral = 25
2690
+ }
2629
2691
  }
2630
2692
  declare namespace ts.server.protocol {
2631
2693
 
@@ -2786,6 +2848,7 @@ declare namespace ts.server.protocol {
2786
2848
  }
2787
2849
  declare namespace ts {
2788
2850
  // these types are empty stubs for types from services and should not be used directly
2851
+ export type EndOfLineState = never;
2789
2852
  export type ScriptKind = never;
2790
2853
  export type WatchFileKind = never;
2791
2854
  export type WatchDirectoryKind = never;
package/lib/tsc.js CHANGED
@@ -65,7 +65,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
65
65
  var ts;
66
66
  (function (ts) {
67
67
  ts.versionMajorMinor = "4.2";
68
- ts.version = ts.versionMajorMinor + ".0-dev.20210209";
68
+ ts.version = "4.2.3";
69
69
  var NativeCollections;
70
70
  (function (NativeCollections) {
71
71
  function tryGetNativeMap() {
@@ -38531,13 +38531,16 @@ var ts;
38531
38531
  return result || ts.emptyArray;
38532
38532
  }
38533
38533
  function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {
38534
- type.members = members;
38535
- type.properties = members === emptySymbols ? ts.emptyArray : getNamedMembers(members);
38536
- type.callSignatures = callSignatures;
38537
- type.constructSignatures = constructSignatures;
38538
- type.stringIndexInfo = stringIndexInfo;
38539
- type.numberIndexInfo = numberIndexInfo;
38540
- return type;
38534
+ var resolved = type;
38535
+ resolved.members = members;
38536
+ resolved.properties = ts.emptyArray;
38537
+ resolved.callSignatures = callSignatures;
38538
+ resolved.constructSignatures = constructSignatures;
38539
+ resolved.stringIndexInfo = stringIndexInfo;
38540
+ resolved.numberIndexInfo = numberIndexInfo;
38541
+ if (members !== emptySymbols)
38542
+ resolved.properties = getNamedMembers(members);
38543
+ return resolved;
38541
38544
  }
38542
38545
  function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) {
38543
38546
  return setStructuredTypeMembers(createObjectType(16, symbol), members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo);
@@ -46050,7 +46053,7 @@ var ts;
46050
46053
  }
46051
46054
  return true;
46052
46055
  }
46053
- function removeRedundantLiteralTypes(types, includes) {
46056
+ function removeRedundantLiteralTypes(types, includes, reduceVoidUndefined) {
46054
46057
  var i = types.length;
46055
46058
  while (i > 0) {
46056
46059
  i--;
@@ -46060,7 +46063,7 @@ var ts;
46060
46063
  flags & 256 && includes & 8 ||
46061
46064
  flags & 2048 && includes & 64 ||
46062
46065
  flags & 8192 && includes & 4096 ||
46063
- flags & 32768 && includes & 16384 ||
46066
+ reduceVoidUndefined && flags & 32768 && includes & 16384 ||
46064
46067
  isFreshLiteralType(t) && containsType(types, t.regularType);
46065
46068
  if (remove) {
46066
46069
  ts.orderedRemoveItemAt(types, i);
@@ -46092,7 +46095,7 @@ var ts;
46092
46095
  if (t.flags & 1048576) {
46093
46096
  var origin = t.origin;
46094
46097
  if (t.aliasSymbol || origin && !(origin.flags & 1048576)) {
46095
- namedUnions.push(t);
46098
+ ts.pushIfUnique(namedUnions, t);
46096
46099
  }
46097
46100
  else if (origin && origin.flags & 1048576) {
46098
46101
  addNamedUnions(namedUnions, origin.types);
@@ -46121,7 +46124,7 @@ var ts;
46121
46124
  }
46122
46125
  if (unionReduction & (1 | 2)) {
46123
46126
  if (includes & (2944 | 8192) || includes & 16384 && includes & 32768) {
46124
- removeRedundantLiteralTypes(typeSet, includes);
46127
+ removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2));
46125
46128
  }
46126
46129
  if (includes & 128 && includes & 134217728) {
46127
46130
  removeStringLiteralsMatchedByTemplateLiterals(typeSet);
@@ -53172,7 +53175,16 @@ var ts;
53172
53175
  var type = getTypeOfDottedName(node.expression, diagnostic);
53173
53176
  if (type) {
53174
53177
  var name = node.name;
53175
- var prop = getPropertyOfType(type, ts.isPrivateIdentifier(name) ? ts.getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText) : name.escapedText);
53178
+ var prop = void 0;
53179
+ if (ts.isPrivateIdentifier(name)) {
53180
+ if (!type.symbol) {
53181
+ return undefined;
53182
+ }
53183
+ prop = getPropertyOfType(type, ts.getSymbolNameForPrivateIdentifier(type.symbol, name.escapedText));
53184
+ }
53185
+ else {
53186
+ prop = getPropertyOfType(type, name.escapedText);
53187
+ }
53176
53188
  return prop && getExplicitTypeOfSymbol(prop, diagnostic);
53177
53189
  }
53178
53190
  return undefined;
@@ -54077,7 +54089,10 @@ var ts;
54077
54089
  return assignableType;
54078
54090
  }
54079
54091
  }
54080
- return isTypeSubtypeOf(candidate, type) ? candidate : isTypeSubtypeOf(type, candidate) ? type : getIntersectionType([type, candidate]);
54092
+ return isTypeSubtypeOf(candidate, type) ? candidate :
54093
+ isTypeAssignableTo(type, candidate) ? type :
54094
+ isTypeAssignableTo(candidate, type) ? candidate :
54095
+ getIntersectionType([type, candidate]);
54081
54096
  }
54082
54097
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
54083
54098
  if (hasMatchingArgument(callExpression, reference)) {
@@ -62905,7 +62920,9 @@ var ts;
62905
62920
  : ts.isPropertyAccessExpression(location) ? location.name
62906
62921
  : ts.isBinaryExpression(location) && ts.isIdentifier(location.right) ? location.right
62907
62922
  : undefined;
62908
- if (!testedNode) {
62923
+ var isPropertyExpressionCast = ts.isPropertyAccessExpression(location)
62924
+ && ts.isAssertionExpression(ts.skipParentheses(location.expression));
62925
+ if (!testedNode || isPropertyExpressionCast) {
62909
62926
  return;
62910
62927
  }
62911
62928
  var possiblyFalsy = getFalsyFlags(type);
@@ -64678,6 +64695,7 @@ var ts;
64678
64695
  return true;
64679
64696
  }
64680
64697
  function checkAliasSymbol(node) {
64698
+ var _a;
64681
64699
  var symbol = getSymbolOfNode(node);
64682
64700
  var target = resolveAlias(symbol);
64683
64701
  if (target !== unknownSymbol) {
@@ -64698,7 +64716,7 @@ var ts;
64698
64716
  && !(node.flags & 8388608)) {
64699
64717
  error(node, ts.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type);
64700
64718
  }
64701
- if (ts.isImportSpecifier(node) && ts.every(target.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); })) {
64719
+ if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); }))) {
64702
64720
  addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
64703
64721
  }
64704
64722
  }
@@ -91655,8 +91673,9 @@ var ts;
91655
91673
  var redirects = host.redirectTargetsMap.get(importedPath) || ts.emptyArray;
91656
91674
  var importedFileNames = __spreadArray(__spreadArray(__spreadArray([], (referenceRedirect ? [referenceRedirect] : ts.emptyArray)), [importedFileName]), redirects);
91657
91675
  var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
91676
+ var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
91658
91677
  if (!preferSymlinks) {
91659
- var result_15 = ts.forEach(targets, function (p) { return !ts.containsIgnoredPath(p) && cb(p, referenceRedirect === p); });
91678
+ var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
91660
91679
  if (result_15)
91661
91680
  return result_15;
91662
91681
  }
@@ -91681,13 +91700,14 @@ var ts;
91681
91700
  var symlinkDirectory = symlinkDirectories_1[_i];
91682
91701
  var option = ts.resolvePath(symlinkDirectory, relative);
91683
91702
  var result_16 = cb(option, target === referenceRedirect);
91703
+ shouldFilterIgnoredPaths = true;
91684
91704
  if (result_16)
91685
91705
  return result_16;
91686
91706
  }
91687
91707
  });
91688
91708
  });
91689
91709
  return result || (preferSymlinks
91690
- ? ts.forEach(targets, function (p) { return ts.containsIgnoredPath(p) ? undefined : cb(p, p === referenceRedirect); })
91710
+ ? ts.forEach(targets, function (p) { return shouldFilterIgnoredPaths && ts.containsIgnoredPath(p) ? undefined : cb(p, p === referenceRedirect); })
91691
91711
  : undefined);
91692
91712
  }
91693
91713
  moduleSpecifiers.forEachFileNameOfModule = forEachFileNameOfModule;