@typescript-deploys/pr-build 5.2.0-pr-54657-9 → 5.2.0-pr-52899-20
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/lib.decorators.d.ts +3 -1
- package/lib/lib.esnext.decorators.d.ts +5 -0
- package/lib/tsc.js +26 -10
- package/lib/tsserver.js +73 -14
- package/lib/tsserverlibrary.js +72 -14
- package/lib/typescript.js +71 -14
- package/lib/typingsInstaller.js +4 -1
- package/package.json +2 -2
package/lib/lib.decorators.d.ts
CHANGED
|
@@ -35,8 +35,10 @@ type DecoratorContext =
|
|
|
35
35
|
| ClassMemberDecoratorContext
|
|
36
36
|
;
|
|
37
37
|
|
|
38
|
+
type DecoratorMetadataObject = Record<PropertyKey, unknown> & object;
|
|
39
|
+
|
|
38
40
|
type DecoratorMetadata =
|
|
39
|
-
typeof globalThis extends { Symbol: { readonly metadata: symbol } } ?
|
|
41
|
+
typeof globalThis extends { Symbol: { readonly metadata: symbol } } ? DecoratorMetadataObject : DecoratorMetadataObject | undefined;
|
|
40
42
|
|
|
41
43
|
/**
|
|
42
44
|
* Context provided to a class decorator.
|
|
@@ -17,7 +17,12 @@ and limitations under the License.
|
|
|
17
17
|
/// <reference no-default-lib="true"/>
|
|
18
18
|
|
|
19
19
|
/// <reference lib="es2015.symbol" />
|
|
20
|
+
/// <reference lib="decorators" />
|
|
20
21
|
|
|
21
22
|
interface SymbolConstructor {
|
|
22
23
|
readonly metadata: unique symbol;
|
|
23
24
|
}
|
|
25
|
+
|
|
26
|
+
interface Function {
|
|
27
|
+
[Symbol.metadata]: DecoratorMetadata | null;
|
|
28
|
+
}
|
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.2";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230623`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -5792,6 +5792,7 @@ var Diagnostics = {
|
|
|
5792
5792
|
A_return_statement_can_only_be_used_within_a_function_body: diag(1108, 1 /* Error */, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."),
|
|
5793
5793
|
Expression_expected: diag(1109, 1 /* Error */, "Expression_expected_1109", "Expression expected."),
|
|
5794
5794
|
Type_expected: diag(1110, 1 /* Error */, "Type_expected_1110", "Type expected."),
|
|
5795
|
+
Private_field_0_must_be_declared_in_an_enclosing_class: diag(1111, 1 /* Error */, "Private_field_0_must_be_declared_in_an_enclosing_class_1111", "Private field '{0}' must be declared in an enclosing class."),
|
|
5795
5796
|
A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: diag(1113, 1 /* Error */, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."),
|
|
5796
5797
|
Duplicate_label_0: diag(1114, 1 /* Error */, "Duplicate_label_0_1114", "Duplicate label '{0}'."),
|
|
5797
5798
|
A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, 1 /* Error */, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."),
|
|
@@ -7747,6 +7748,7 @@ var Diagnostics = {
|
|
|
7747
7748
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
7748
7749
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
7749
7750
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
7751
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
7750
7752
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7751
7753
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7752
7754
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -12915,6 +12917,10 @@ function getContainingClassStaticBlock(node) {
|
|
|
12915
12917
|
function getContainingFunctionOrClassStaticBlock(node) {
|
|
12916
12918
|
return findAncestor(node.parent, isFunctionLikeOrClassStaticBlockDeclaration);
|
|
12917
12919
|
}
|
|
12920
|
+
function getContainingClassExcludingClassDecorators(node) {
|
|
12921
|
+
const decorator = findAncestor(node.parent, (n) => isClassLike(n) ? "quit" : isDecorator(n));
|
|
12922
|
+
return decorator && isClassLike(decorator.parent) ? getContainingClass(decorator.parent) : getContainingClass(decorator ?? node);
|
|
12923
|
+
}
|
|
12918
12924
|
function getThisContainer(node, includeArrowFunctions, includeClassComputedPropertyName) {
|
|
12919
12925
|
Debug.assert(node.kind !== 312 /* SourceFile */);
|
|
12920
12926
|
while (true) {
|
|
@@ -66037,7 +66043,7 @@ function createTypeChecker(host) {
|
|
|
66037
66043
|
location = location.parent;
|
|
66038
66044
|
}
|
|
66039
66045
|
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
|
66040
|
-
const type = getTypeOfExpression(location);
|
|
66046
|
+
const type = removeOptionalTypeMarker(getTypeOfExpression(location));
|
|
66041
66047
|
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
|
66042
66048
|
return type;
|
|
66043
66049
|
}
|
|
@@ -69048,7 +69054,7 @@ function createTypeChecker(host) {
|
|
|
69048
69054
|
return isCallOrNewExpression(node.parent) && node.parent.expression === node;
|
|
69049
69055
|
}
|
|
69050
69056
|
function lookupSymbolForPrivateIdentifierDeclaration(propName, location) {
|
|
69051
|
-
for (let containingClass =
|
|
69057
|
+
for (let containingClass = getContainingClassExcludingClassDecorators(location); !!containingClass; containingClass = getContainingClass(containingClass)) {
|
|
69052
69058
|
const { symbol } = containingClass;
|
|
69053
69059
|
const name = getSymbolNameForPrivateIdentifier(symbol, propName);
|
|
69054
69060
|
const prop = symbol.members && symbol.members.get(name) || symbol.exports && symbol.exports.get(name);
|
|
@@ -69184,16 +69190,22 @@ function createTypeChecker(host) {
|
|
|
69184
69190
|
if (lexicallyScopedSymbol) {
|
|
69185
69191
|
return isErrorType(apparentType) ? errorType : apparentType;
|
|
69186
69192
|
}
|
|
69187
|
-
if (
|
|
69193
|
+
if (getContainingClassExcludingClassDecorators(right) === void 0) {
|
|
69188
69194
|
grammarErrorOnNode(right, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
69189
69195
|
return anyType;
|
|
69190
69196
|
}
|
|
69191
69197
|
}
|
|
69192
|
-
prop = lexicallyScopedSymbol
|
|
69193
|
-
if (
|
|
69194
|
-
|
|
69198
|
+
prop = lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedSymbol);
|
|
69199
|
+
if (prop === void 0) {
|
|
69200
|
+
if (checkPrivateIdentifierPropertyAccess(leftType, right, lexicallyScopedSymbol)) {
|
|
69201
|
+
return errorType;
|
|
69202
|
+
}
|
|
69203
|
+
const containingClass = getContainingClassExcludingClassDecorators(right);
|
|
69204
|
+
if (containingClass && isPlainJsFile(getSourceFileOfNode(containingClass), compilerOptions.checkJs)) {
|
|
69205
|
+
grammarErrorOnNode(right, Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class, idText(right));
|
|
69206
|
+
}
|
|
69195
69207
|
} else {
|
|
69196
|
-
const isSetonlyAccessor = prop
|
|
69208
|
+
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
69197
69209
|
if (isSetonlyAccessor && assignmentKind !== 1 /* Definite */) {
|
|
69198
69210
|
error(node, Diagnostics.Private_accessor_was_defined_without_a_getter);
|
|
69199
69211
|
}
|
|
@@ -89781,9 +89793,12 @@ function transformClassFields(context) {
|
|
|
89781
89793
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
89782
89794
|
}
|
|
89783
89795
|
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
89784
|
-
const isClassWithConstructorReference2 = classCheckFlags & 1048576 /* ClassWithConstructorReference */;
|
|
89785
89796
|
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
89786
|
-
const temp2 = factory2.createTempVariable(
|
|
89797
|
+
const temp2 = factory2.createTempVariable(
|
|
89798
|
+
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
89799
|
+
/*reservedInNestedScopes*/
|
|
89800
|
+
true
|
|
89801
|
+
);
|
|
89787
89802
|
getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp2);
|
|
89788
89803
|
return temp2;
|
|
89789
89804
|
}
|
|
@@ -115181,6 +115196,7 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
115181
115196
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
115182
115197
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
115183
115198
|
Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
115199
|
+
Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class.code,
|
|
115184
115200
|
// Type errors
|
|
115185
115201
|
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
115186
115202
|
]);
|
package/lib/tsserver.js
CHANGED
|
@@ -693,6 +693,7 @@ __export(server_exports, {
|
|
|
693
693
|
getContainerFlags: () => getContainerFlags,
|
|
694
694
|
getContainerNode: () => getContainerNode,
|
|
695
695
|
getContainingClass: () => getContainingClass,
|
|
696
|
+
getContainingClassExcludingClassDecorators: () => getContainingClassExcludingClassDecorators,
|
|
696
697
|
getContainingClassStaticBlock: () => getContainingClassStaticBlock,
|
|
697
698
|
getContainingFunction: () => getContainingFunction,
|
|
698
699
|
getContainingFunctionDeclaration: () => getContainingFunctionDeclaration,
|
|
@@ -2326,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2326
2327
|
|
|
2327
2328
|
// src/compiler/corePublic.ts
|
|
2328
2329
|
var versionMajorMinor = "5.2";
|
|
2329
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2330
|
+
var version = `${versionMajorMinor}.0-insiders.20230623`;
|
|
2330
2331
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2331
2332
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2332
2333
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9312,6 +9313,7 @@ var Diagnostics = {
|
|
|
9312
9313
|
A_return_statement_can_only_be_used_within_a_function_body: diag(1108, 1 /* Error */, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."),
|
|
9313
9314
|
Expression_expected: diag(1109, 1 /* Error */, "Expression_expected_1109", "Expression expected."),
|
|
9314
9315
|
Type_expected: diag(1110, 1 /* Error */, "Type_expected_1110", "Type expected."),
|
|
9316
|
+
Private_field_0_must_be_declared_in_an_enclosing_class: diag(1111, 1 /* Error */, "Private_field_0_must_be_declared_in_an_enclosing_class_1111", "Private field '{0}' must be declared in an enclosing class."),
|
|
9315
9317
|
A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: diag(1113, 1 /* Error */, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."),
|
|
9316
9318
|
Duplicate_label_0: diag(1114, 1 /* Error */, "Duplicate_label_0_1114", "Duplicate label '{0}'."),
|
|
9317
9319
|
A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, 1 /* Error */, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."),
|
|
@@ -11267,6 +11269,7 @@ var Diagnostics = {
|
|
|
11267
11269
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
11268
11270
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
11269
11271
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
11272
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
11270
11273
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
11271
11274
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
11272
11275
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -16749,6 +16752,10 @@ function getContainingClassStaticBlock(node) {
|
|
|
16749
16752
|
function getContainingFunctionOrClassStaticBlock(node) {
|
|
16750
16753
|
return findAncestor(node.parent, isFunctionLikeOrClassStaticBlockDeclaration);
|
|
16751
16754
|
}
|
|
16755
|
+
function getContainingClassExcludingClassDecorators(node) {
|
|
16756
|
+
const decorator = findAncestor(node.parent, (n) => isClassLike(n) ? "quit" : isDecorator(n));
|
|
16757
|
+
return decorator && isClassLike(decorator.parent) ? getContainingClass(decorator.parent) : getContainingClass(decorator ?? node);
|
|
16758
|
+
}
|
|
16752
16759
|
function getThisContainer(node, includeArrowFunctions, includeClassComputedPropertyName) {
|
|
16753
16760
|
Debug.assert(node.kind !== 312 /* SourceFile */);
|
|
16754
16761
|
while (true) {
|
|
@@ -70712,7 +70719,7 @@ function createTypeChecker(host) {
|
|
|
70712
70719
|
location = location.parent;
|
|
70713
70720
|
}
|
|
70714
70721
|
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
|
70715
|
-
const type = getTypeOfExpression(location);
|
|
70722
|
+
const type = removeOptionalTypeMarker(getTypeOfExpression(location));
|
|
70716
70723
|
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
|
70717
70724
|
return type;
|
|
70718
70725
|
}
|
|
@@ -73723,7 +73730,7 @@ function createTypeChecker(host) {
|
|
|
73723
73730
|
return isCallOrNewExpression(node.parent) && node.parent.expression === node;
|
|
73724
73731
|
}
|
|
73725
73732
|
function lookupSymbolForPrivateIdentifierDeclaration(propName, location) {
|
|
73726
|
-
for (let containingClass =
|
|
73733
|
+
for (let containingClass = getContainingClassExcludingClassDecorators(location); !!containingClass; containingClass = getContainingClass(containingClass)) {
|
|
73727
73734
|
const { symbol } = containingClass;
|
|
73728
73735
|
const name = getSymbolNameForPrivateIdentifier(symbol, propName);
|
|
73729
73736
|
const prop = symbol.members && symbol.members.get(name) || symbol.exports && symbol.exports.get(name);
|
|
@@ -73859,16 +73866,22 @@ function createTypeChecker(host) {
|
|
|
73859
73866
|
if (lexicallyScopedSymbol) {
|
|
73860
73867
|
return isErrorType(apparentType) ? errorType : apparentType;
|
|
73861
73868
|
}
|
|
73862
|
-
if (
|
|
73869
|
+
if (getContainingClassExcludingClassDecorators(right) === void 0) {
|
|
73863
73870
|
grammarErrorOnNode(right, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
73864
73871
|
return anyType;
|
|
73865
73872
|
}
|
|
73866
73873
|
}
|
|
73867
|
-
prop = lexicallyScopedSymbol
|
|
73868
|
-
if (
|
|
73869
|
-
|
|
73874
|
+
prop = lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedSymbol);
|
|
73875
|
+
if (prop === void 0) {
|
|
73876
|
+
if (checkPrivateIdentifierPropertyAccess(leftType, right, lexicallyScopedSymbol)) {
|
|
73877
|
+
return errorType;
|
|
73878
|
+
}
|
|
73879
|
+
const containingClass = getContainingClassExcludingClassDecorators(right);
|
|
73880
|
+
if (containingClass && isPlainJsFile(getSourceFileOfNode(containingClass), compilerOptions.checkJs)) {
|
|
73881
|
+
grammarErrorOnNode(right, Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class, idText(right));
|
|
73882
|
+
}
|
|
73870
73883
|
} else {
|
|
73871
|
-
const isSetonlyAccessor = prop
|
|
73884
|
+
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
73872
73885
|
if (isSetonlyAccessor && assignmentKind !== 1 /* Definite */) {
|
|
73873
73886
|
error2(node, Diagnostics.Private_accessor_was_defined_without_a_getter);
|
|
73874
73887
|
}
|
|
@@ -94627,9 +94640,12 @@ function transformClassFields(context) {
|
|
|
94627
94640
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
94628
94641
|
}
|
|
94629
94642
|
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
94630
|
-
const isClassWithConstructorReference2 = classCheckFlags & 1048576 /* ClassWithConstructorReference */;
|
|
94631
94643
|
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
94632
|
-
const temp2 = factory2.createTempVariable(
|
|
94644
|
+
const temp2 = factory2.createTempVariable(
|
|
94645
|
+
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
94646
|
+
/*reservedInNestedScopes*/
|
|
94647
|
+
true
|
|
94648
|
+
);
|
|
94633
94649
|
getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp2);
|
|
94634
94650
|
return temp2;
|
|
94635
94651
|
}
|
|
@@ -120092,6 +120108,7 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
120092
120108
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
120093
120109
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
120094
120110
|
Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
120111
|
+
Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class.code,
|
|
120095
120112
|
// Type errors
|
|
120096
120113
|
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
120097
120114
|
]);
|
|
@@ -156645,6 +156662,7 @@ var CompletionSource = /* @__PURE__ */ ((CompletionSource2) => {
|
|
|
156645
156662
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
156646
156663
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
156647
156664
|
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
156665
|
+
CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
|
|
156648
156666
|
return CompletionSource2;
|
|
156649
156667
|
})(CompletionSource || {});
|
|
156650
156668
|
var SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
@@ -157523,6 +157541,7 @@ function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
|
157523
157541
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
157524
157542
|
}
|
|
157525
157543
|
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
157544
|
+
var _a, _b;
|
|
157526
157545
|
let insertText;
|
|
157527
157546
|
let filterText;
|
|
157528
157547
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
@@ -157581,6 +157600,10 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
157581
157600
|
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
157582
157601
|
hasAction = true;
|
|
157583
157602
|
}
|
|
157603
|
+
if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */ && (isMethodDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, (node) => isPropertyAssignment(node))) == null ? void 0 : _b.getLastToken()) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(contextToken.getSourceFile(), contextToken.getEnd()).line !== getLineAndCharacterOfPosition(contextToken.getSourceFile(), position).line)) {
|
|
157604
|
+
source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
|
|
157605
|
+
hasAction = true;
|
|
157606
|
+
}
|
|
157584
157607
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
157585
157608
|
let importAdder;
|
|
157586
157609
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
@@ -158311,7 +158334,7 @@ function getSymbolCompletionFromEntryId(program, log, sourceFile, position, entr
|
|
|
158311
158334
|
return firstDefined(symbols, (symbol, index) => {
|
|
158312
158335
|
const origin = symbolToOriginInfoMap[index];
|
|
158313
158336
|
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
158314
|
-
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
158337
|
+
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
158315
158338
|
}) || { type: "none" };
|
|
158316
158339
|
}
|
|
158317
158340
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
@@ -158456,6 +158479,21 @@ function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextTo
|
|
|
158456
158479
|
Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
|
|
158457
158480
|
return { codeActions: [codeAction2], sourceDisplay: void 0 };
|
|
158458
158481
|
}
|
|
158482
|
+
if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
|
|
158483
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
158484
|
+
{ host, formatContext, preferences },
|
|
158485
|
+
(tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
|
|
158486
|
+
);
|
|
158487
|
+
if (changes) {
|
|
158488
|
+
return {
|
|
158489
|
+
sourceDisplay: void 0,
|
|
158490
|
+
codeActions: [{
|
|
158491
|
+
changes,
|
|
158492
|
+
description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
|
|
158493
|
+
}]
|
|
158494
|
+
};
|
|
158495
|
+
}
|
|
158496
|
+
}
|
|
158459
158497
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
158460
158498
|
return { codeActions: void 0, sourceDisplay: void 0 };
|
|
158461
158499
|
}
|
|
@@ -159362,7 +159400,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159362
159400
|
}
|
|
159363
159401
|
function tryGetObjectLikeCompletionSymbols() {
|
|
159364
159402
|
const symbolsStartIndex = symbols.length;
|
|
159365
|
-
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
|
|
159403
|
+
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position);
|
|
159366
159404
|
if (!objectLikeContainer)
|
|
159367
159405
|
return 0 /* Continue */;
|
|
159368
159406
|
completionKind = 0 /* ObjectPropertyDeclaration */;
|
|
@@ -159848,7 +159886,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
159848
159886
|
return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
|
|
159849
159887
|
}
|
|
159850
159888
|
}
|
|
159851
|
-
function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
159889
|
+
function tryGetObjectLikeCompletionContainer(contextToken, position) {
|
|
159852
159890
|
if (contextToken) {
|
|
159853
159891
|
const { parent: parent2 } = contextToken;
|
|
159854
159892
|
switch (contextToken.kind) {
|
|
@@ -159863,7 +159901,26 @@ function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
|
159863
159901
|
case 134 /* AsyncKeyword */:
|
|
159864
159902
|
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
159865
159903
|
case 80 /* Identifier */:
|
|
159866
|
-
|
|
159904
|
+
if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) {
|
|
159905
|
+
return contextToken.parent.parent;
|
|
159906
|
+
} else {
|
|
159907
|
+
if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(contextToken.getSourceFile(), contextToken.getEnd()).line !== getLineAndCharacterOfPosition(contextToken.getSourceFile(), position).line)) {
|
|
159908
|
+
return contextToken.parent.parent;
|
|
159909
|
+
}
|
|
159910
|
+
const ancestorNode2 = findAncestor(parent2, (node) => isPropertyAssignment(node));
|
|
159911
|
+
if (ancestorNode2 && ancestorNode2.getLastToken() === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
|
|
159912
|
+
return ancestorNode2.parent;
|
|
159913
|
+
}
|
|
159914
|
+
}
|
|
159915
|
+
break;
|
|
159916
|
+
default:
|
|
159917
|
+
if (parent2.parent && parent2.parent.parent && isMethodDeclaration(parent2.parent) && isObjectLiteralExpression(parent2.parent.parent)) {
|
|
159918
|
+
return parent2.parent.parent;
|
|
159919
|
+
}
|
|
159920
|
+
const ancestorNode = findAncestor(parent2, (node) => isPropertyAssignment(node));
|
|
159921
|
+
if (contextToken.kind !== 59 /* ColonToken */ && ancestorNode && ancestorNode.getLastToken() === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
|
|
159922
|
+
return ancestorNode.parent;
|
|
159923
|
+
}
|
|
159867
159924
|
}
|
|
159868
159925
|
}
|
|
159869
159926
|
return void 0;
|
|
@@ -172206,6 +172263,7 @@ __export(ts_exports2, {
|
|
|
172206
172263
|
getContainerFlags: () => getContainerFlags,
|
|
172207
172264
|
getContainerNode: () => getContainerNode,
|
|
172208
172265
|
getContainingClass: () => getContainingClass,
|
|
172266
|
+
getContainingClassExcludingClassDecorators: () => getContainingClassExcludingClassDecorators,
|
|
172209
172267
|
getContainingClassStaticBlock: () => getContainingClassStaticBlock,
|
|
172210
172268
|
getContainingFunction: () => getContainingFunction,
|
|
172211
172269
|
getContainingFunctionDeclaration: () => getContainingFunctionDeclaration,
|
|
@@ -186718,6 +186776,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
186718
186776
|
getContainerFlags,
|
|
186719
186777
|
getContainerNode,
|
|
186720
186778
|
getContainingClass,
|
|
186779
|
+
getContainingClassExcludingClassDecorators,
|
|
186721
186780
|
getContainingClassStaticBlock,
|
|
186722
186781
|
getContainingFunction,
|
|
186723
186782
|
getContainingFunctionDeclaration,
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230623`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7096,6 +7096,7 @@ ${lanes.join("\n")}
|
|
|
7096
7096
|
A_return_statement_can_only_be_used_within_a_function_body: diag(1108, 1 /* Error */, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."),
|
|
7097
7097
|
Expression_expected: diag(1109, 1 /* Error */, "Expression_expected_1109", "Expression expected."),
|
|
7098
7098
|
Type_expected: diag(1110, 1 /* Error */, "Type_expected_1110", "Type expected."),
|
|
7099
|
+
Private_field_0_must_be_declared_in_an_enclosing_class: diag(1111, 1 /* Error */, "Private_field_0_must_be_declared_in_an_enclosing_class_1111", "Private field '{0}' must be declared in an enclosing class."),
|
|
7099
7100
|
A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: diag(1113, 1 /* Error */, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."),
|
|
7100
7101
|
Duplicate_label_0: diag(1114, 1 /* Error */, "Duplicate_label_0_1114", "Duplicate label '{0}'."),
|
|
7101
7102
|
A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, 1 /* Error */, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."),
|
|
@@ -9051,6 +9052,7 @@ ${lanes.join("\n")}
|
|
|
9051
9052
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
9052
9053
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
9053
9054
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
9055
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
9054
9056
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
9055
9057
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
9056
9058
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -14530,6 +14532,10 @@ ${lanes.join("\n")}
|
|
|
14530
14532
|
function getContainingFunctionOrClassStaticBlock(node) {
|
|
14531
14533
|
return findAncestor(node.parent, isFunctionLikeOrClassStaticBlockDeclaration);
|
|
14532
14534
|
}
|
|
14535
|
+
function getContainingClassExcludingClassDecorators(node) {
|
|
14536
|
+
const decorator = findAncestor(node.parent, (n) => isClassLike(n) ? "quit" : isDecorator(n));
|
|
14537
|
+
return decorator && isClassLike(decorator.parent) ? getContainingClass(decorator.parent) : getContainingClass(decorator ?? node);
|
|
14538
|
+
}
|
|
14533
14539
|
function getThisContainer(node, includeArrowFunctions, includeClassComputedPropertyName) {
|
|
14534
14540
|
Debug.assert(node.kind !== 312 /* SourceFile */);
|
|
14535
14541
|
while (true) {
|
|
@@ -68480,7 +68486,7 @@ ${lanes.join("\n")}
|
|
|
68480
68486
|
location = location.parent;
|
|
68481
68487
|
}
|
|
68482
68488
|
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
|
68483
|
-
const type = getTypeOfExpression(location);
|
|
68489
|
+
const type = removeOptionalTypeMarker(getTypeOfExpression(location));
|
|
68484
68490
|
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
|
68485
68491
|
return type;
|
|
68486
68492
|
}
|
|
@@ -71491,7 +71497,7 @@ ${lanes.join("\n")}
|
|
|
71491
71497
|
return isCallOrNewExpression(node.parent) && node.parent.expression === node;
|
|
71492
71498
|
}
|
|
71493
71499
|
function lookupSymbolForPrivateIdentifierDeclaration(propName, location) {
|
|
71494
|
-
for (let containingClass =
|
|
71500
|
+
for (let containingClass = getContainingClassExcludingClassDecorators(location); !!containingClass; containingClass = getContainingClass(containingClass)) {
|
|
71495
71501
|
const { symbol } = containingClass;
|
|
71496
71502
|
const name = getSymbolNameForPrivateIdentifier(symbol, propName);
|
|
71497
71503
|
const prop = symbol.members && symbol.members.get(name) || symbol.exports && symbol.exports.get(name);
|
|
@@ -71627,16 +71633,22 @@ ${lanes.join("\n")}
|
|
|
71627
71633
|
if (lexicallyScopedSymbol) {
|
|
71628
71634
|
return isErrorType(apparentType) ? errorType : apparentType;
|
|
71629
71635
|
}
|
|
71630
|
-
if (
|
|
71636
|
+
if (getContainingClassExcludingClassDecorators(right) === void 0) {
|
|
71631
71637
|
grammarErrorOnNode(right, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
71632
71638
|
return anyType;
|
|
71633
71639
|
}
|
|
71634
71640
|
}
|
|
71635
|
-
prop = lexicallyScopedSymbol
|
|
71636
|
-
if (
|
|
71637
|
-
|
|
71641
|
+
prop = lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedSymbol);
|
|
71642
|
+
if (prop === void 0) {
|
|
71643
|
+
if (checkPrivateIdentifierPropertyAccess(leftType, right, lexicallyScopedSymbol)) {
|
|
71644
|
+
return errorType;
|
|
71645
|
+
}
|
|
71646
|
+
const containingClass = getContainingClassExcludingClassDecorators(right);
|
|
71647
|
+
if (containingClass && isPlainJsFile(getSourceFileOfNode(containingClass), compilerOptions.checkJs)) {
|
|
71648
|
+
grammarErrorOnNode(right, Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class, idText(right));
|
|
71649
|
+
}
|
|
71638
71650
|
} else {
|
|
71639
|
-
const isSetonlyAccessor = prop
|
|
71651
|
+
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
71640
71652
|
if (isSetonlyAccessor && assignmentKind !== 1 /* Definite */) {
|
|
71641
71653
|
error2(node, Diagnostics.Private_accessor_was_defined_without_a_getter);
|
|
71642
71654
|
}
|
|
@@ -92584,9 +92596,12 @@ ${lanes.join("\n")}
|
|
|
92584
92596
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
92585
92597
|
}
|
|
92586
92598
|
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
92587
|
-
const isClassWithConstructorReference2 = classCheckFlags & 1048576 /* ClassWithConstructorReference */;
|
|
92588
92599
|
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
92589
|
-
const temp2 = factory2.createTempVariable(
|
|
92600
|
+
const temp2 = factory2.createTempVariable(
|
|
92601
|
+
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
92602
|
+
/*reservedInNestedScopes*/
|
|
92603
|
+
true
|
|
92604
|
+
);
|
|
92590
92605
|
getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp2);
|
|
92591
92606
|
return temp2;
|
|
92592
92607
|
}
|
|
@@ -121475,6 +121490,7 @@ ${lanes.join("\n")}
|
|
|
121475
121490
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
121476
121491
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
121477
121492
|
Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
121493
|
+
Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class.code,
|
|
121478
121494
|
// Type errors
|
|
121479
121495
|
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
121480
121496
|
]);
|
|
@@ -156757,6 +156773,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156757
156773
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
156758
156774
|
}
|
|
156759
156775
|
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
156776
|
+
var _a, _b;
|
|
156760
156777
|
let insertText;
|
|
156761
156778
|
let filterText;
|
|
156762
156779
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
@@ -156815,6 +156832,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156815
156832
|
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
156816
156833
|
hasAction = true;
|
|
156817
156834
|
}
|
|
156835
|
+
if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */ && (isMethodDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, (node) => isPropertyAssignment(node))) == null ? void 0 : _b.getLastToken()) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(contextToken.getSourceFile(), contextToken.getEnd()).line !== getLineAndCharacterOfPosition(contextToken.getSourceFile(), position).line)) {
|
|
156836
|
+
source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
|
|
156837
|
+
hasAction = true;
|
|
156838
|
+
}
|
|
156818
156839
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
156819
156840
|
let importAdder;
|
|
156820
156841
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
@@ -157545,7 +157566,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157545
157566
|
return firstDefined(symbols, (symbol, index) => {
|
|
157546
157567
|
const origin = symbolToOriginInfoMap[index];
|
|
157547
157568
|
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
157548
|
-
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
157569
|
+
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
157549
157570
|
}) || { type: "none" };
|
|
157550
157571
|
}
|
|
157551
157572
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
@@ -157690,6 +157711,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157690
157711
|
Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
|
|
157691
157712
|
return { codeActions: [codeAction2], sourceDisplay: void 0 };
|
|
157692
157713
|
}
|
|
157714
|
+
if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
|
|
157715
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
157716
|
+
{ host, formatContext, preferences },
|
|
157717
|
+
(tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
|
|
157718
|
+
);
|
|
157719
|
+
if (changes) {
|
|
157720
|
+
return {
|
|
157721
|
+
sourceDisplay: void 0,
|
|
157722
|
+
codeActions: [{
|
|
157723
|
+
changes,
|
|
157724
|
+
description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
|
|
157725
|
+
}]
|
|
157726
|
+
};
|
|
157727
|
+
}
|
|
157728
|
+
}
|
|
157693
157729
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
157694
157730
|
return { codeActions: void 0, sourceDisplay: void 0 };
|
|
157695
157731
|
}
|
|
@@ -158587,7 +158623,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158587
158623
|
}
|
|
158588
158624
|
function tryGetObjectLikeCompletionSymbols() {
|
|
158589
158625
|
const symbolsStartIndex = symbols.length;
|
|
158590
|
-
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
|
|
158626
|
+
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position);
|
|
158591
158627
|
if (!objectLikeContainer)
|
|
158592
158628
|
return 0 /* Continue */;
|
|
158593
158629
|
completionKind = 0 /* ObjectPropertyDeclaration */;
|
|
@@ -159073,7 +159109,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159073
159109
|
return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
|
|
159074
159110
|
}
|
|
159075
159111
|
}
|
|
159076
|
-
function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
159112
|
+
function tryGetObjectLikeCompletionContainer(contextToken, position) {
|
|
159077
159113
|
if (contextToken) {
|
|
159078
159114
|
const { parent: parent2 } = contextToken;
|
|
159079
159115
|
switch (contextToken.kind) {
|
|
@@ -159088,7 +159124,26 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159088
159124
|
case 134 /* AsyncKeyword */:
|
|
159089
159125
|
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
159090
159126
|
case 80 /* Identifier */:
|
|
159091
|
-
|
|
159127
|
+
if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) {
|
|
159128
|
+
return contextToken.parent.parent;
|
|
159129
|
+
} else {
|
|
159130
|
+
if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(contextToken.getSourceFile(), contextToken.getEnd()).line !== getLineAndCharacterOfPosition(contextToken.getSourceFile(), position).line)) {
|
|
159131
|
+
return contextToken.parent.parent;
|
|
159132
|
+
}
|
|
159133
|
+
const ancestorNode2 = findAncestor(parent2, (node) => isPropertyAssignment(node));
|
|
159134
|
+
if (ancestorNode2 && ancestorNode2.getLastToken() === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
|
|
159135
|
+
return ancestorNode2.parent;
|
|
159136
|
+
}
|
|
159137
|
+
}
|
|
159138
|
+
break;
|
|
159139
|
+
default:
|
|
159140
|
+
if (parent2.parent && parent2.parent.parent && isMethodDeclaration(parent2.parent) && isObjectLiteralExpression(parent2.parent.parent)) {
|
|
159141
|
+
return parent2.parent.parent;
|
|
159142
|
+
}
|
|
159143
|
+
const ancestorNode = findAncestor(parent2, (node) => isPropertyAssignment(node));
|
|
159144
|
+
if (contextToken.kind !== 59 /* ColonToken */ && ancestorNode && ancestorNode.getLastToken() === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
|
|
159145
|
+
return ancestorNode.parent;
|
|
159146
|
+
}
|
|
159092
159147
|
}
|
|
159093
159148
|
}
|
|
159094
159149
|
return void 0;
|
|
@@ -159630,6 +159685,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159630
159685
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
159631
159686
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
159632
159687
|
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
159688
|
+
CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
|
|
159633
159689
|
return CompletionSource2;
|
|
159634
159690
|
})(CompletionSource || {});
|
|
159635
159691
|
SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
@@ -183347,6 +183403,7 @@ ${e.message}`;
|
|
|
183347
183403
|
getContainerFlags: () => getContainerFlags,
|
|
183348
183404
|
getContainerNode: () => getContainerNode,
|
|
183349
183405
|
getContainingClass: () => getContainingClass,
|
|
183406
|
+
getContainingClassExcludingClassDecorators: () => getContainingClassExcludingClassDecorators,
|
|
183350
183407
|
getContainingClassStaticBlock: () => getContainingClassStaticBlock,
|
|
183351
183408
|
getContainingFunction: () => getContainingFunction,
|
|
183352
183409
|
getContainingFunctionDeclaration: () => getContainingFunctionDeclaration,
|
|
@@ -185749,6 +185806,7 @@ ${e.message}`;
|
|
|
185749
185806
|
getContainerFlags: () => getContainerFlags,
|
|
185750
185807
|
getContainerNode: () => getContainerNode,
|
|
185751
185808
|
getContainingClass: () => getContainingClass,
|
|
185809
|
+
getContainingClassExcludingClassDecorators: () => getContainingClassExcludingClassDecorators,
|
|
185752
185810
|
getContainingClassStaticBlock: () => getContainingClassStaticBlock,
|
|
185753
185811
|
getContainingFunction: () => getContainingFunction,
|
|
185754
185812
|
getContainingFunctionDeclaration: () => getContainingFunctionDeclaration,
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20230623`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7096,6 +7096,7 @@ ${lanes.join("\n")}
|
|
|
7096
7096
|
A_return_statement_can_only_be_used_within_a_function_body: diag(1108, 1 /* Error */, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."),
|
|
7097
7097
|
Expression_expected: diag(1109, 1 /* Error */, "Expression_expected_1109", "Expression expected."),
|
|
7098
7098
|
Type_expected: diag(1110, 1 /* Error */, "Type_expected_1110", "Type expected."),
|
|
7099
|
+
Private_field_0_must_be_declared_in_an_enclosing_class: diag(1111, 1 /* Error */, "Private_field_0_must_be_declared_in_an_enclosing_class_1111", "Private field '{0}' must be declared in an enclosing class."),
|
|
7099
7100
|
A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: diag(1113, 1 /* Error */, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."),
|
|
7100
7101
|
Duplicate_label_0: diag(1114, 1 /* Error */, "Duplicate_label_0_1114", "Duplicate label '{0}'."),
|
|
7101
7102
|
A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, 1 /* Error */, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."),
|
|
@@ -9051,6 +9052,7 @@ ${lanes.join("\n")}
|
|
|
9051
9052
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
9052
9053
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
9053
9054
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
9055
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
9054
9056
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
9055
9057
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
9056
9058
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -14530,6 +14532,10 @@ ${lanes.join("\n")}
|
|
|
14530
14532
|
function getContainingFunctionOrClassStaticBlock(node) {
|
|
14531
14533
|
return findAncestor(node.parent, isFunctionLikeOrClassStaticBlockDeclaration);
|
|
14532
14534
|
}
|
|
14535
|
+
function getContainingClassExcludingClassDecorators(node) {
|
|
14536
|
+
const decorator = findAncestor(node.parent, (n) => isClassLike(n) ? "quit" : isDecorator(n));
|
|
14537
|
+
return decorator && isClassLike(decorator.parent) ? getContainingClass(decorator.parent) : getContainingClass(decorator ?? node);
|
|
14538
|
+
}
|
|
14533
14539
|
function getThisContainer(node, includeArrowFunctions, includeClassComputedPropertyName) {
|
|
14534
14540
|
Debug.assert(node.kind !== 312 /* SourceFile */);
|
|
14535
14541
|
while (true) {
|
|
@@ -68480,7 +68486,7 @@ ${lanes.join("\n")}
|
|
|
68480
68486
|
location = location.parent;
|
|
68481
68487
|
}
|
|
68482
68488
|
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
|
68483
|
-
const type = getTypeOfExpression(location);
|
|
68489
|
+
const type = removeOptionalTypeMarker(getTypeOfExpression(location));
|
|
68484
68490
|
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
|
68485
68491
|
return type;
|
|
68486
68492
|
}
|
|
@@ -71491,7 +71497,7 @@ ${lanes.join("\n")}
|
|
|
71491
71497
|
return isCallOrNewExpression(node.parent) && node.parent.expression === node;
|
|
71492
71498
|
}
|
|
71493
71499
|
function lookupSymbolForPrivateIdentifierDeclaration(propName, location) {
|
|
71494
|
-
for (let containingClass =
|
|
71500
|
+
for (let containingClass = getContainingClassExcludingClassDecorators(location); !!containingClass; containingClass = getContainingClass(containingClass)) {
|
|
71495
71501
|
const { symbol } = containingClass;
|
|
71496
71502
|
const name = getSymbolNameForPrivateIdentifier(symbol, propName);
|
|
71497
71503
|
const prop = symbol.members && symbol.members.get(name) || symbol.exports && symbol.exports.get(name);
|
|
@@ -71627,16 +71633,22 @@ ${lanes.join("\n")}
|
|
|
71627
71633
|
if (lexicallyScopedSymbol) {
|
|
71628
71634
|
return isErrorType(apparentType) ? errorType : apparentType;
|
|
71629
71635
|
}
|
|
71630
|
-
if (
|
|
71636
|
+
if (getContainingClassExcludingClassDecorators(right) === void 0) {
|
|
71631
71637
|
grammarErrorOnNode(right, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
71632
71638
|
return anyType;
|
|
71633
71639
|
}
|
|
71634
71640
|
}
|
|
71635
|
-
prop = lexicallyScopedSymbol
|
|
71636
|
-
if (
|
|
71637
|
-
|
|
71641
|
+
prop = lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedSymbol);
|
|
71642
|
+
if (prop === void 0) {
|
|
71643
|
+
if (checkPrivateIdentifierPropertyAccess(leftType, right, lexicallyScopedSymbol)) {
|
|
71644
|
+
return errorType;
|
|
71645
|
+
}
|
|
71646
|
+
const containingClass = getContainingClassExcludingClassDecorators(right);
|
|
71647
|
+
if (containingClass && isPlainJsFile(getSourceFileOfNode(containingClass), compilerOptions.checkJs)) {
|
|
71648
|
+
grammarErrorOnNode(right, Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class, idText(right));
|
|
71649
|
+
}
|
|
71638
71650
|
} else {
|
|
71639
|
-
const isSetonlyAccessor = prop
|
|
71651
|
+
const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */);
|
|
71640
71652
|
if (isSetonlyAccessor && assignmentKind !== 1 /* Definite */) {
|
|
71641
71653
|
error2(node, Diagnostics.Private_accessor_was_defined_without_a_getter);
|
|
71642
71654
|
}
|
|
@@ -92584,9 +92596,12 @@ ${lanes.join("\n")}
|
|
|
92584
92596
|
return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis;
|
|
92585
92597
|
}
|
|
92586
92598
|
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
92587
|
-
const isClassWithConstructorReference2 = classCheckFlags & 1048576 /* ClassWithConstructorReference */;
|
|
92588
92599
|
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
92589
|
-
const temp2 = factory2.createTempVariable(
|
|
92600
|
+
const temp2 = factory2.createTempVariable(
|
|
92601
|
+
requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration,
|
|
92602
|
+
/*reservedInNestedScopes*/
|
|
92603
|
+
true
|
|
92604
|
+
);
|
|
92590
92605
|
getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp2);
|
|
92591
92606
|
return temp2;
|
|
92592
92607
|
}
|
|
@@ -121475,6 +121490,7 @@ ${lanes.join("\n")}
|
|
|
121475
121490
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
121476
121491
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
121477
121492
|
Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
121493
|
+
Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class.code,
|
|
121478
121494
|
// Type errors
|
|
121479
121495
|
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
121480
121496
|
]);
|
|
@@ -156772,6 +156788,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156772
156788
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
156773
156789
|
}
|
|
156774
156790
|
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
156791
|
+
var _a, _b;
|
|
156775
156792
|
let insertText;
|
|
156776
156793
|
let filterText;
|
|
156777
156794
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
@@ -156830,6 +156847,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156830
156847
|
if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
|
|
156831
156848
|
hasAction = true;
|
|
156832
156849
|
}
|
|
156850
|
+
if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */ && (isMethodDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, (node) => isPropertyAssignment(node))) == null ? void 0 : _b.getLastToken()) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(contextToken.getSourceFile(), contextToken.getEnd()).line !== getLineAndCharacterOfPosition(contextToken.getSourceFile(), position).line)) {
|
|
156851
|
+
source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
|
|
156852
|
+
hasAction = true;
|
|
156853
|
+
}
|
|
156833
156854
|
if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
156834
156855
|
let importAdder;
|
|
156835
156856
|
const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
|
|
@@ -157560,7 +157581,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157560
157581
|
return firstDefined(symbols, (symbol, index) => {
|
|
157561
157582
|
const origin = symbolToOriginInfoMap[index];
|
|
157562
157583
|
const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
157563
|
-
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
157584
|
+
return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
|
|
157564
157585
|
}) || { type: "none" };
|
|
157565
157586
|
}
|
|
157566
157587
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
@@ -157705,6 +157726,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157705
157726
|
Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
|
|
157706
157727
|
return { codeActions: [codeAction2], sourceDisplay: void 0 };
|
|
157707
157728
|
}
|
|
157729
|
+
if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
|
|
157730
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
157731
|
+
{ host, formatContext, preferences },
|
|
157732
|
+
(tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
|
|
157733
|
+
);
|
|
157734
|
+
if (changes) {
|
|
157735
|
+
return {
|
|
157736
|
+
sourceDisplay: void 0,
|
|
157737
|
+
codeActions: [{
|
|
157738
|
+
changes,
|
|
157739
|
+
description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
|
|
157740
|
+
}]
|
|
157741
|
+
};
|
|
157742
|
+
}
|
|
157743
|
+
}
|
|
157708
157744
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
157709
157745
|
return { codeActions: void 0, sourceDisplay: void 0 };
|
|
157710
157746
|
}
|
|
@@ -158602,7 +158638,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158602
158638
|
}
|
|
158603
158639
|
function tryGetObjectLikeCompletionSymbols() {
|
|
158604
158640
|
const symbolsStartIndex = symbols.length;
|
|
158605
|
-
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
|
|
158641
|
+
const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position);
|
|
158606
158642
|
if (!objectLikeContainer)
|
|
158607
158643
|
return 0 /* Continue */;
|
|
158608
158644
|
completionKind = 0 /* ObjectPropertyDeclaration */;
|
|
@@ -159088,7 +159124,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159088
159124
|
return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
|
|
159089
159125
|
}
|
|
159090
159126
|
}
|
|
159091
|
-
function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
159127
|
+
function tryGetObjectLikeCompletionContainer(contextToken, position) {
|
|
159092
159128
|
if (contextToken) {
|
|
159093
159129
|
const { parent: parent2 } = contextToken;
|
|
159094
159130
|
switch (contextToken.kind) {
|
|
@@ -159103,7 +159139,26 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159103
159139
|
case 134 /* AsyncKeyword */:
|
|
159104
159140
|
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
159105
159141
|
case 80 /* Identifier */:
|
|
159106
|
-
|
|
159142
|
+
if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) {
|
|
159143
|
+
return contextToken.parent.parent;
|
|
159144
|
+
} else {
|
|
159145
|
+
if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(contextToken.getSourceFile(), contextToken.getEnd()).line !== getLineAndCharacterOfPosition(contextToken.getSourceFile(), position).line)) {
|
|
159146
|
+
return contextToken.parent.parent;
|
|
159147
|
+
}
|
|
159148
|
+
const ancestorNode2 = findAncestor(parent2, (node) => isPropertyAssignment(node));
|
|
159149
|
+
if (ancestorNode2 && ancestorNode2.getLastToken() === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
|
|
159150
|
+
return ancestorNode2.parent;
|
|
159151
|
+
}
|
|
159152
|
+
}
|
|
159153
|
+
break;
|
|
159154
|
+
default:
|
|
159155
|
+
if (parent2.parent && parent2.parent.parent && isMethodDeclaration(parent2.parent) && isObjectLiteralExpression(parent2.parent.parent)) {
|
|
159156
|
+
return parent2.parent.parent;
|
|
159157
|
+
}
|
|
159158
|
+
const ancestorNode = findAncestor(parent2, (node) => isPropertyAssignment(node));
|
|
159159
|
+
if (contextToken.kind !== 59 /* ColonToken */ && ancestorNode && ancestorNode.getLastToken() === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
|
|
159160
|
+
return ancestorNode.parent;
|
|
159161
|
+
}
|
|
159107
159162
|
}
|
|
159108
159163
|
}
|
|
159109
159164
|
return void 0;
|
|
@@ -159645,6 +159700,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159645
159700
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
159646
159701
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
159647
159702
|
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
159703
|
+
CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
|
|
159648
159704
|
return CompletionSource2;
|
|
159649
159705
|
})(CompletionSource || {});
|
|
159650
159706
|
SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
@@ -171969,6 +172025,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171969
172025
|
getContainerFlags: () => getContainerFlags,
|
|
171970
172026
|
getContainerNode: () => getContainerNode,
|
|
171971
172027
|
getContainingClass: () => getContainingClass,
|
|
172028
|
+
getContainingClassExcludingClassDecorators: () => getContainingClassExcludingClassDecorators,
|
|
171972
172029
|
getContainingClassStaticBlock: () => getContainingClassStaticBlock,
|
|
171973
172030
|
getContainingFunction: () => getContainingFunction,
|
|
171974
172031
|
getContainingFunctionDeclaration: () => getContainingFunctionDeclaration,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.2";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20230623`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -5166,6 +5166,7 @@ var Diagnostics = {
|
|
|
5166
5166
|
A_return_statement_can_only_be_used_within_a_function_body: diag(1108, 1 /* Error */, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."),
|
|
5167
5167
|
Expression_expected: diag(1109, 1 /* Error */, "Expression_expected_1109", "Expression expected."),
|
|
5168
5168
|
Type_expected: diag(1110, 1 /* Error */, "Type_expected_1110", "Type expected."),
|
|
5169
|
+
Private_field_0_must_be_declared_in_an_enclosing_class: diag(1111, 1 /* Error */, "Private_field_0_must_be_declared_in_an_enclosing_class_1111", "Private field '{0}' must be declared in an enclosing class."),
|
|
5169
5170
|
A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: diag(1113, 1 /* Error */, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."),
|
|
5170
5171
|
Duplicate_label_0: diag(1114, 1 /* Error */, "Duplicate_label_0_1114", "Duplicate label '{0}'."),
|
|
5171
5172
|
A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, 1 /* Error */, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."),
|
|
@@ -7121,6 +7122,7 @@ var Diagnostics = {
|
|
|
7121
7122
|
Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
|
|
7122
7123
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
7123
7124
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
7125
|
+
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
7124
7126
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7125
7127
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7126
7128
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -30821,6 +30823,7 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
30821
30823
|
Diagnostics.Class_constructor_may_not_be_an_accessor.code,
|
|
30822
30824
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
30823
30825
|
Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
30826
|
+
Diagnostics.Private_field_0_must_be_declared_in_an_enclosing_class.code,
|
|
30824
30827
|
// Type errors
|
|
30825
30828
|
Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
|
|
30826
30829
|
]);
|
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.2.0-pr-
|
|
5
|
+
"version": "5.2.0-pr-52899-20",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"node": "20.1.0",
|
|
116
116
|
"npm": "8.19.4"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "c1175951e647970ae871beecc7dc204a7daeafb1"
|
|
119
119
|
}
|