Support for auto-accessor fields from the Stage 3 Decorators proposal (#49705)

* Support for auto-accessor fields

* Add tests, ensure accessors are initialized in ctor

* classFields cleanup and PR feedback
This commit is contained in:
Ron Buckton authored and GitHub committed 2022-09-12 15:12:11 -04:00
1 parent 77374732df
commit a4cabe725b
196 files changed
+7464 -1234

No files matched your search

+1 -1
View File
@@ -46,7 +46,7 @@ module.exports = createRule({
context.report({ messageId: "secondArgumentDebugAssertError", node: message1Node });
}
if (argsLen < 3) {
if (argsLen !== 3) {
return;
}
+4 -1
View File
@@ -2732,7 +2732,10 @@ namespace ts {
}
function bindPropertyWorker(node: PropertyDeclaration | PropertySignature) {
return bindPropertyOrMethodOrAccessor(node, SymbolFlags.Property | (node.questionToken ? SymbolFlags.Optional : SymbolFlags.None), SymbolFlags.PropertyExcludes);
const isAutoAccessor = isAutoAccessorPropertyDeclaration(node);
const includes = isAutoAccessor ? SymbolFlags.Accessor : SymbolFlags.Property;
const excludes = isAutoAccessor ? SymbolFlags.AccessorExcludes : SymbolFlags.PropertyExcludes;
return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? SymbolFlags.Optional : SymbolFlags.None), excludes);
}
function bindAnonymousTypeWorker(node: TypeLiteralNode | MappedTypeNode | JSDocTypeLiteral) {
+74 -19
View File
@@ -9083,7 +9083,7 @@ namespace ts {
return getTypeForBindingElement(declaration as BindingElement);
}
const isProperty = isPropertyDeclaration(declaration) || isPropertySignature(declaration);
const isProperty = isPropertyDeclaration(declaration) && !hasAccessorModifier(declaration) || isPropertySignature(declaration);
const isOptional = includeOptionality && (
isProperty && !!declaration.questionToken ||
isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) ||
@@ -9831,21 +9831,25 @@ namespace ts {
return type;
}
function getAnnotatedAccessorTypeNode(accessor: AccessorDeclaration | undefined): TypeNode | undefined {
function getAnnotatedAccessorTypeNode(accessor: AccessorDeclaration | PropertyDeclaration | undefined): TypeNode | undefined {
if (accessor) {
if (accessor.kind === SyntaxKind.GetAccessor) {
const getterTypeAnnotation = getEffectiveReturnTypeNode(accessor);
return getterTypeAnnotation;
}
else {
const setterTypeAnnotation = getEffectiveSetAccessorTypeAnnotationNode(accessor);
return setterTypeAnnotation;
switch (accessor.kind) {
case SyntaxKind.GetAccessor:
const getterTypeAnnotation = getEffectiveReturnTypeNode(accessor);
return getterTypeAnnotation;
case SyntaxKind.SetAccessor:
const setterTypeAnnotation = getEffectiveSetAccessorTypeAnnotationNode(accessor);
return setterTypeAnnotation;
case SyntaxKind.PropertyDeclaration:
Debug.assert(hasAccessorModifier(accessor));
const accessorTypeAnnotation = getEffectiveTypeAnnotationNode(accessor);
return accessorTypeAnnotation;
}
}
return undefined;
}
function getAnnotatedAccessorType(accessor: AccessorDeclaration | undefined): Type | undefined {
function getAnnotatedAccessorType(accessor: AccessorDeclaration | PropertyDeclaration | undefined): Type | undefined {
const node = getAnnotatedAccessorTypeNode(accessor);
return node && getTypeFromTypeNode(node);
}
@@ -9867,12 +9871,16 @@ namespace ts {
}
const getter = getDeclarationOfKind<AccessorDeclaration>(symbol, SyntaxKind.GetAccessor);
const setter = getDeclarationOfKind<AccessorDeclaration>(symbol, SyntaxKind.SetAccessor);
const accessor = tryCast(getDeclarationOfKind<PropertyDeclaration>(symbol, SyntaxKind.PropertyDeclaration), isAutoAccessorPropertyDeclaration);
// We try to resolve a getter type annotation, a setter type annotation, or a getter function
// body return type inference, in that order.
let type = getter && isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) ||
getAnnotatedAccessorType(getter) ||
getAnnotatedAccessorType(setter) ||
getter && getter.body && getReturnTypeFromBody(getter);
getAnnotatedAccessorType(accessor) ||
getter && getter.body && getReturnTypeFromBody(getter) ||
accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true);
if (!type) {
if (setter && !isPrivateWithinAmbient(setter)) {
errorOrSuggestion(noImplicitAny, setter, Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
@@ -9880,6 +9888,9 @@ namespace ts {
else if (getter && !isPrivateWithinAmbient(getter)) {
errorOrSuggestion(noImplicitAny, getter, Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol));
}
else if (accessor && !isPrivateWithinAmbient(accessor)) {
errorOrSuggestion(noImplicitAny, accessor, Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any");
}
type = anyType;
}
if (!popTypeResolution()) {
@@ -9889,6 +9900,9 @@ namespace ts {
else if (getAnnotatedAccessorTypeNode(setter)) {
error(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
}
else if (getAnnotatedAccessorTypeNode(accessor)) {
error(setter, Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
}
else if (getter && noImplicitAny) {
error(getter, Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
@@ -9905,7 +9919,9 @@ namespace ts {
if (!pushTypeResolution(symbol, TypeSystemPropertyName.WriteType)) {
return errorType;
}
const setter = getDeclarationOfKind<AccessorDeclaration>(symbol, SyntaxKind.SetAccessor);
const setter = getDeclarationOfKind<AccessorDeclaration>(symbol, SyntaxKind.SetAccessor)
?? tryCast(getDeclarationOfKind<PropertyDeclaration>(symbol, SyntaxKind.PropertyDeclaration), isAutoAccessorPropertyDeclaration);
let writeType = getAnnotatedAccessorType(setter);
if (!popTypeResolution()) {
if (getAnnotatedAccessorTypeNode(setter)) {
@@ -11063,8 +11079,10 @@ namespace ts {
const members = getMembersOfDeclaration(decl);
if (members) {
for (const member of members) {
if (isStatic === hasStaticModifier(member) && hasLateBindableName(member)) {
lateBindMember(symbol, earlySymbols, lateSymbols, member);
if (isStatic === hasStaticModifier(member)) {
if (hasLateBindableName(member)) {
lateBindMember(symbol, earlySymbols, lateSymbols, member);
}
}
}
}
@@ -11078,8 +11096,10 @@ namespace ts {
|| isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind)
|| assignmentKind === AssignmentDeclarationKind.ObjectDefinePrototypeProperty
|| assignmentKind === AssignmentDeclarationKind.Prototype; // A straight `Prototype` assignment probably can never have a computed name
if (isStatic === !isInstanceMember && hasLateBindableName(member)) {
lateBindMember(symbol, earlySymbols, lateSymbols, member);
if (isStatic === !isInstanceMember) {
if (hasLateBindableName(member)) {
lateBindMember(symbol, earlySymbols, lateSymbols, member);
}
}
}
}
@@ -12924,7 +12944,7 @@ namespace ts {
}
function isOptionalPropertyDeclaration(node: Declaration) {
return isPropertyDeclaration(node) && node.questionToken;
return isPropertyDeclaration(node) && !hasAccessorModifier(node) && node.questionToken;
}
function isOptionalJSDocPropertyLikeTag(node: Node): node is JSDocPropertyLikeTag {
@@ -30759,7 +30779,7 @@ namespace ts {
// A method or accessor declaration decorator will have two or three arguments (see
// `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators
// for ES3, we will only pass two arguments.
const hasPropDesc = parent.kind !== SyntaxKind.PropertyDeclaration && languageVersion !== ScriptTarget.ES3;
const hasPropDesc = languageVersion !== ScriptTarget.ES3 && (!isPropertyDeclaration(parent) || hasAccessorModifier(parent));
return [
createSyntheticExpression(expr, getParentTypeOfClassElement(parent as ClassElement)),
createSyntheticExpression(expr, getClassElementPropertyKeyType(parent as ClassElement)),
@@ -30778,7 +30798,7 @@ namespace ts {
case SyntaxKind.ClassExpression:
return 1;
case SyntaxKind.PropertyDeclaration:
return 2;
return hasAccessorModifier(node.parent) ? 3 : 2;
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
@@ -44189,6 +44209,9 @@ namespace ts {
else if (flags & ModifierFlags.Readonly) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly");
}
else if (flags & ModifierFlags.Accessor) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor");
}
else if (flags & ModifierFlags.Async) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "override", "async");
}
@@ -44210,6 +44233,9 @@ namespace ts {
else if (flags & ModifierFlags.Static) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "static");
}
else if (flags & ModifierFlags.Accessor) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor");
}
else if (flags & ModifierFlags.Readonly) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly");
}
@@ -44243,6 +44269,9 @@ namespace ts {
else if (flags & ModifierFlags.Async) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
else if (flags & ModifierFlags.Accessor) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor");
}
else if (node.parent.kind === SyntaxKind.ModuleBlock || node.parent.kind === SyntaxKind.SourceFile) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
@@ -44259,6 +44288,23 @@ namespace ts {
lastStatic = modifier;
break;
case SyntaxKind.AccessorKeyword:
if (flags & ModifierFlags.Accessor) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "accessor");
}
else if (flags & ModifierFlags.Readonly) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly");
}
else if (flags & ModifierFlags.Ambient) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare");
}
else if (node.kind !== SyntaxKind.PropertyDeclaration) {
return grammarErrorOnNode(modifier, Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration);
}
flags |= ModifierFlags.Accessor;
break;
case SyntaxKind.ReadonlyKeyword:
if (flags & ModifierFlags.Readonly) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly");
@@ -44355,6 +44401,9 @@ namespace ts {
if (flags & ModifierFlags.Override) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override");
}
if (flags & ModifierFlags.Accessor) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor");
}
}
if (isNamedDeclaration(node) && node.name.kind === SyntaxKind.PrivateIdentifier) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract");
@@ -45553,6 +45602,12 @@ namespace ts {
if (languageVersion < ScriptTarget.ES2015 && isPrivateIdentifier(node.name)) {
return grammarErrorOnNode(node.name, Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher);
}
if (languageVersion < ScriptTarget.ES2015 && isAutoAccessorPropertyDeclaration(node)) {
return grammarErrorOnNode(node.name, Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher);
}
if (isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, Diagnostics.An_accessor_property_cannot_be_declared_optional)) {
return true;
}
}
else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) {
if (checkGrammarForInvalidDynamicName(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
+12
View File
@@ -899,6 +899,14 @@
"category": "Error",
"code": 1274
},
"'accessor' modifier can only appear on a property declaration.": {
"category": "Error",
"code": 1275
},
"An 'accessor' property cannot be declared optional.": {
"category": "Error",
"code": 1276
},
"'with' statements are not allowed in an async function block.": {
"category": "Error",
@@ -7485,5 +7493,9 @@
"'{0}' is automatically exported here.": {
"category": "Message",
"code": 18044
},
"Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.": {
"category": "Error",
"code": 18045
}
}
+118 -69
View File
@@ -903,6 +903,10 @@ namespace ts {
let nodeIdToGeneratedName: string[]; // Map of generated names for specific nodes.
let autoGeneratedIdToGeneratedName: string[]; // Map of generated names for temp and loop variables.
let generatedNames: Set<string>; // Set of names generated by the NameGenerator.
let formattedNameTempFlagsStack: (ESMap<string, TempFlags> | undefined)[];
let formattedNameTempFlags: ESMap<string, TempFlags> | undefined;
let privateNameTempFlagsStack: TempFlags[]; // Stack of enclosing name generation scopes.
let privateNameTempFlags: TempFlags; // TempFlags for the current name generation scope.
let tempFlagsStack: TempFlags[]; // Stack of enclosing name generation scopes.
let tempFlags: TempFlags; // TempFlags for the current name generation scope.
let reservedNamesStack: Set<string>[]; // Stack of TempFlags reserved in enclosing name generation scopes.
@@ -1191,6 +1195,10 @@ namespace ts {
nodeIdToGeneratedName = [];
autoGeneratedIdToGeneratedName = [];
generatedNames = new Set();
formattedNameTempFlagsStack = [];
formattedNameTempFlags = new Map();
privateNameTempFlagsStack = [];
privateNameTempFlags = TempFlags.Auto;
tempFlagsStack = [];
tempFlags = TempFlags.Auto;
reservedNamesStack = [];
@@ -4954,7 +4962,7 @@ namespace ts {
}
function getTextOfNode(node: Identifier | PrivateIdentifier | LiteralExpression, includeTrivia?: boolean): string {
if (isGeneratedIdentifier(node)) {
if (isGeneratedIdentifier(node) || isGeneratedPrivateIdentifier(node)) {
return generateName(node);
}
if (isStringLiteral(node) && node.textSourceNode) {
@@ -4979,7 +4987,7 @@ namespace ts {
function getLiteralTextOfNode(node: LiteralLikeNode, neverAsciiEscape: boolean | undefined, jsxAttributeEscape: boolean): string {
if (node.kind === SyntaxKind.StringLiteral && (node as StringLiteral).textSourceNode) {
const textSourceNode = (node as StringLiteral).textSourceNode!;
if (isIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) {
if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) {
const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode);
return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` :
neverAsciiEscape || (getEmitFlags(node) & EmitFlags.NoAsciiEscaping) ? `"${escapeString(text)}"` :
@@ -5006,7 +5014,11 @@ namespace ts {
return;
}
tempFlagsStack.push(tempFlags);
tempFlags = 0;
tempFlags = TempFlags.Auto;
privateNameTempFlagsStack.push(privateNameTempFlags);
privateNameTempFlags = TempFlags.Auto;
formattedNameTempFlagsStack.push(formattedNameTempFlags);
formattedNameTempFlags = undefined;
reservedNamesStack.push(reservedNames);
}
@@ -5018,6 +5030,8 @@ namespace ts {
return;
}
tempFlags = tempFlagsStack.pop()!;
privateNameTempFlags = privateNameTempFlagsStack.pop()!;
formattedNameTempFlags = formattedNameTempFlagsStack.pop();
reservedNames = reservedNamesStack.pop()!;
}
@@ -5130,7 +5144,7 @@ namespace ts {
function generateNameIfNeeded(name: DeclarationName | undefined) {
if (name) {
if (isGeneratedIdentifier(name)) {
if (isGeneratedIdentifier(name) || isGeneratedPrivateIdentifier(name)) {
generateName(name);
}
else if (isBindingPattern(name)) {
@@ -5142,11 +5156,11 @@ namespace ts {
/**
* Generate the text for a generated identifier.
*/
function generateName(name: GeneratedIdentifier) {
function generateName(name: GeneratedIdentifier | GeneratedPrivateIdentifier) {
if ((name.autoGenerateFlags & GeneratedIdentifierFlags.KindMask) === GeneratedIdentifierFlags.Node) {
// Node names generate unique names based on their original node
// and are cached based on that node's id.
return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags);
return generateNameCached(getNodeForGeneratedName(name), isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix);
}
else {
// Auto, Loop, and Unique names are cached based on their unique
@@ -5156,9 +5170,9 @@ namespace ts {
}
}
function generateNameCached(node: Node, flags?: GeneratedIdentifierFlags) {
function generateNameCached(node: Node, privateName: boolean, flags?: GeneratedIdentifierFlags, prefix?: string | GeneratedNamePart, suffix?: string) {
const nodeId = getNodeId(node);
return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags));
return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags ?? GeneratedIdentifierFlags.None, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix)));
}
/**
@@ -5194,22 +5208,59 @@ namespace ts {
return true;
}
function getTempFlags(formattedNameKey: string) {
switch (formattedNameKey) {
case "":
return tempFlags;
case "#":
return privateNameTempFlags;
default:
return formattedNameTempFlags?.get(formattedNameKey) ?? TempFlags.Auto;
}
}
function setTempFlags(formattedNameKey: string, flags: TempFlags) {
switch (formattedNameKey) {
case "":
tempFlags = flags;
break;
case "#":
privateNameTempFlags = flags;
break;
default:
formattedNameTempFlags ??= new Map();
formattedNameTempFlags.set(formattedNameKey, flags);
break;
}
}
/**
* Return the next available name in the pattern _a ... _z, _0, _1, ...
* TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name.
* Note that names generated by makeTempVariableName and makeUniqueName will never conflict.
*/
function makeTempVariableName(flags: TempFlags, reservedInNestedScopes?: boolean): string {
function makeTempVariableName(flags: TempFlags, reservedInNestedScopes: boolean, privateName: boolean, prefix: string, suffix: string): string {
if (prefix.length > 0 && prefix.charCodeAt(0) === CharacterCodes.hash) {
prefix = prefix.slice(1);
}
// Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name.
const key = formatGeneratedName(privateName, prefix, "", suffix);
let tempFlags = getTempFlags(key);
if (flags && !(tempFlags & flags)) {
const name = flags === TempFlags._i ? "_i" : "_n";
if (isUniqueName(name)) {
const fullName = formatGeneratedName(privateName, prefix, name, suffix);
if (isUniqueName(fullName)) {
tempFlags |= flags;
if (reservedInNestedScopes) {
reserveNameInNestedScopes(name);
reserveNameInNestedScopes(fullName);
}
return name;
setTempFlags(key, tempFlags);
return fullName;
}
}
while (true) {
const count = tempFlags & TempFlags.CountMask;
tempFlags++;
@@ -5218,11 +5269,13 @@ namespace ts {
const name = count < 26
? "_" + String.fromCharCode(CharacterCodes.a + count)
: "_" + (count - 26);
if (isUniqueName(name)) {
const fullName = formatGeneratedName(privateName, prefix, name, suffix);
if (isUniqueName(fullName)) {
if (reservedInNestedScopes) {
reserveNameInNestedScopes(name);
reserveNameInNestedScopes(fullName);
}
return name;
setTempFlags(key, tempFlags);
return fullName;
}
}
}
@@ -5235,16 +5288,23 @@ namespace ts {
* makeUniqueName are guaranteed to never conflict.
* If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1'
*/
function makeUniqueName(baseName: string, checkFn: (name: string) => boolean = isUniqueName, optimistic?: boolean, scoped?: boolean): string {
function makeUniqueName(baseName: string, checkFn: (name: string) => boolean = isUniqueName, optimistic: boolean, scoped: boolean, privateName: boolean, prefix: string, suffix: string): string {
if (baseName.length > 0 && baseName.charCodeAt(0) === CharacterCodes.hash) {
baseName = baseName.slice(1);
}
if (prefix.length > 0 && prefix.charCodeAt(0) === CharacterCodes.hash) {
prefix = prefix.slice(1);
}
if (optimistic) {
if (checkFn(baseName)) {
const fullName = formatGeneratedName(privateName, prefix, baseName, suffix);
if (checkFn(fullName)) {
if (scoped) {
reserveNameInNestedScopes(baseName);
reserveNameInNestedScopes(fullName);
}
else {
generatedNames.add(baseName);
generatedNames.add(fullName);
}
return baseName;
return fullName;
}
}
// Find the first unique 'name_n', where n is a positive number
@@ -5253,22 +5313,22 @@ namespace ts {
}
let i = 1;
while (true) {
const generatedName = baseName + i;
if (checkFn(generatedName)) {
const fullName = formatGeneratedName(privateName, prefix, baseName + i, suffix);
if (checkFn(fullName)) {
if (scoped) {
reserveNameInNestedScopes(generatedName);
reserveNameInNestedScopes(fullName);
}
else {
generatedNames.add(generatedName);
generatedNames.add(fullName);
}
return generatedName;
return fullName;
}
i++;
}
}
function makeFileLevelOptimisticUniqueName(name: string) {
return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true);
return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ "");
}
/**
@@ -5277,7 +5337,7 @@ namespace ts {
function generateNameForModuleOrEnum(node: ModuleDeclaration | EnumDeclaration) {
const name = getTextOfNode(node.name);
// Use module/enum name itself if it is unique, otherwise make a unique variation
return isUniqueLocalName(name, node) ? name : makeUniqueName(name);
return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ "");
}
/**
@@ -5287,109 +5347,98 @@ namespace ts {
const expr = getExternalModuleName(node)!; // TODO: GH#18217
const baseName = isStringLiteral(expr) ?
makeIdentifierFromModuleName(expr.text) : "module";
return makeUniqueName(baseName);
return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ "");
}
/**
* Generates a unique name for a default export.
*/
function generateNameForExportDefault() {
return makeUniqueName("default");
return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ "");
}
/**
* Generates a unique name for a class expression.
*/
function generateNameForClassExpression() {
return makeUniqueName("class");
return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ "");
}
function generateNameForMethodOrAccessor(node: MethodDeclaration | AccessorDeclaration) {
function generateNameForMethodOrAccessor(node: MethodDeclaration | AccessorDeclaration, privateName: boolean, prefix: string, suffix: string) {
if (isIdentifier(node.name)) {
return generateNameCached(node.name);
return generateNameCached(node.name, privateName);
}
return makeTempVariableName(TempFlags.Auto);
return makeTempVariableName(TempFlags.Auto, /*reservedInNestedScopes*/ false, privateName, prefix, suffix);
}
/**
* Generates a unique name from a node.
*/
function generateNameForNode(node: Node, flags?: GeneratedIdentifierFlags): string {
function generateNameForNode(node: Node, privateName: boolean, flags: GeneratedIdentifierFlags, prefix: string, suffix: string): string {
switch (node.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.PrivateIdentifier:
return makeUniqueName(
getTextOfNode(node as Identifier),
isUniqueName,
!!(flags! & GeneratedIdentifierFlags.Optimistic),
!!(flags! & GeneratedIdentifierFlags.ReservedInNestedScopes)
!!(flags & GeneratedIdentifierFlags.Optimistic),
!!(flags & GeneratedIdentifierFlags.ReservedInNestedScopes),
privateName,
prefix,
suffix
);
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.EnumDeclaration:
Debug.assert(!prefix && !suffix && !privateName);
return generateNameForModuleOrEnum(node as ModuleDeclaration | EnumDeclaration);
case SyntaxKind.ImportDeclaration:
case SyntaxKind.ExportDeclaration:
Debug.assert(!prefix && !suffix && !privateName);
return generateNameForImportOrExportDeclaration(node as ImportDeclaration | ExportDeclaration);
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.ExportAssignment:
Debug.assert(!prefix && !suffix && !privateName);
return generateNameForExportDefault();
case SyntaxKind.ClassExpression:
Debug.assert(!prefix && !suffix && !privateName);
return generateNameForClassExpression();
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return generateNameForMethodOrAccessor(node as MethodDeclaration | AccessorDeclaration);
return generateNameForMethodOrAccessor(node as MethodDeclaration | AccessorDeclaration, privateName, prefix, suffix);
case SyntaxKind.ComputedPropertyName:
return makeTempVariableName(TempFlags.Auto, /*reserveInNestedScopes*/ true);
return makeTempVariableName(TempFlags.Auto, /*reserveInNestedScopes*/ true, privateName, prefix, suffix);
default:
return makeTempVariableName(TempFlags.Auto);
return makeTempVariableName(TempFlags.Auto, /*reserveInNestedScopes*/ false, privateName, prefix, suffix);
}
}
/**
* Generates a unique identifier for a node.
*/
function makeName(name: GeneratedIdentifier) {
function makeName(name: GeneratedIdentifier | GeneratedPrivateIdentifier) {
const prefix = formatGeneratedNamePart(name.autoGeneratePrefix, generateName);
const suffix = formatGeneratedNamePart (name.autoGenerateSuffix);
switch (name.autoGenerateFlags & GeneratedIdentifierFlags.KindMask) {
case GeneratedIdentifierFlags.Auto:
return makeTempVariableName(TempFlags.Auto, !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes));
return makeTempVariableName(TempFlags.Auto, !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes), isPrivateIdentifier(name), prefix, suffix);
case GeneratedIdentifierFlags.Loop:
return makeTempVariableName(TempFlags._i, !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes));
Debug.assertNode(name, isIdentifier);
return makeTempVariableName(TempFlags._i, !!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes), /*privateName*/ false, prefix, suffix);
case GeneratedIdentifierFlags.Unique:
return makeUniqueName(
idText(name),
(name.autoGenerateFlags & GeneratedIdentifierFlags.FileLevel) ? isFileLevelUniqueName : isUniqueName,
!!(name.autoGenerateFlags & GeneratedIdentifierFlags.Optimistic),
!!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes)
!!(name.autoGenerateFlags & GeneratedIdentifierFlags.ReservedInNestedScopes),
isPrivateIdentifier(name),
prefix,
suffix
);
}
return Debug.fail("Unsupported GeneratedIdentifierKind.");
}
/**
* Gets the node from which a name should be generated.
*/
function getNodeForGeneratedName(name: GeneratedIdentifier) {
const autoGenerateId = name.autoGenerateId;
let node = name as Node;
let original = node.original;
while (original) {
node = original;
// if "node" is a different generated name (having a different
// "autoGenerateId"), use it and stop traversing.
if (isIdentifier(node)
&& !!(node.autoGenerateFlags! & GeneratedIdentifierFlags.Node)
&& node.autoGenerateId !== autoGenerateId) {
break;
}
original = node.original;
}
// otherwise, return the original node for the source;
return node;
return Debug.fail(`Unsupported GeneratedIdentifierKind: ${Debug.formatEnum(name.autoGenerateFlags & GeneratedIdentifierFlags.KindMask, (ts as any).GeneratedIdentifierFlags, /*isFlags*/ true)}.`);
}
// Comments
+57 -12
View File
@@ -60,6 +60,8 @@ namespace ts {
createUniqueName,
getGeneratedNameForNode,
createPrivateIdentifier,
createUniquePrivateName,
getGeneratedPrivateNameForNode,
createToken,
createSuper,
createThis,
@@ -819,7 +821,7 @@ namespace ts {
}
// @api
function createStringLiteralFromNode(sourceNode: PropertyNameLiteral): StringLiteral {
function createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier): StringLiteral {
const node = createBaseStringLiteral(getTextOfIdentifierOrLiteral(sourceNode), /*isSingleQuote*/ undefined);
node.textSourceNode = sourceNode;
return node;
@@ -861,10 +863,12 @@ namespace ts {
return node;
}
function createBaseGeneratedIdentifier(text: string, autoGenerateFlags: GeneratedIdentifierFlags) {
function createBaseGeneratedIdentifier(text: string, autoGenerateFlags: GeneratedIdentifierFlags, prefix: string | GeneratedNamePart | undefined, suffix: string | undefined) {
const node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined) as Mutable<GeneratedIdentifier>;
node.autoGenerateFlags = autoGenerateFlags;
node.autoGenerateId = nextAutoGenerateId;
node.autoGeneratePrefix = prefix;
node.autoGenerateSuffix = suffix;
nextAutoGenerateId++;
return node;
}
@@ -890,10 +894,10 @@ namespace ts {
}
// @api
function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes?: boolean): GeneratedIdentifier {
function createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes?: boolean, prefix?: string | GeneratedNamePart, suffix?: string): GeneratedIdentifier {
let flags = GeneratedIdentifierFlags.Auto;
if (reservedInNestedScopes) flags |= GeneratedIdentifierFlags.ReservedInNestedScopes;
const name = createBaseGeneratedIdentifier("", flags);
const name = createBaseGeneratedIdentifier("", flags, prefix, suffix);
if (recordTempVariable) {
recordTempVariable(name);
}
@@ -905,35 +909,72 @@ namespace ts {
function createLoopVariable(reservedInNestedScopes?: boolean): Identifier {
let flags = GeneratedIdentifierFlags.Loop;
if (reservedInNestedScopes) flags |= GeneratedIdentifierFlags.ReservedInNestedScopes;
return createBaseGeneratedIdentifier("", flags);
return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined);
}
/** Create a unique name based on the supplied text. */
// @api
function createUniqueName(text: string, flags: GeneratedIdentifierFlags = GeneratedIdentifierFlags.None): Identifier {
function createUniqueName(text: string, flags: GeneratedIdentifierFlags = GeneratedIdentifierFlags.None, prefix?: string | GeneratedNamePart, suffix?: string): Identifier {
Debug.assert(!(flags & GeneratedIdentifierFlags.KindMask), "Argument out of range: flags");
Debug.assert((flags & (GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel)) !== GeneratedIdentifierFlags.FileLevel, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic");
return createBaseGeneratedIdentifier(text, GeneratedIdentifierFlags.Unique | flags);
return createBaseGeneratedIdentifier(text, GeneratedIdentifierFlags.Unique | flags, prefix, suffix);
}
/** Create a unique name generated for a node. */
// @api
function getGeneratedNameForNode(node: Node | undefined, flags: GeneratedIdentifierFlags = 0): Identifier {
function getGeneratedNameForNode(node: Node | undefined, flags: GeneratedIdentifierFlags = 0, prefix?: string | GeneratedNamePart, suffix?: string): Identifier {
Debug.assert(!(flags & GeneratedIdentifierFlags.KindMask), "Argument out of range: flags");
const name = createBaseGeneratedIdentifier(node && isIdentifier(node) ? idText(node) : "", GeneratedIdentifierFlags.Node | flags);
const text = !node ? "" :
isMemberName(node) ? formatGeneratedName(/*privateName*/ false, prefix, node, suffix, idText) :
`generated@${getNodeId(node)}`;
if (prefix || suffix) flags |= GeneratedIdentifierFlags.Optimistic;
const name = createBaseGeneratedIdentifier(text, GeneratedIdentifierFlags.Node | flags, prefix, suffix);
name.original = node;
return name;
}
function createBasePrivateIdentifier(text: string) {
const node = baseFactory.createBasePrivateIdentifierNode(SyntaxKind.PrivateIdentifier) as Mutable<PrivateIdentifier>;
node.escapedText = escapeLeadingUnderscores(text);
node.transformFlags |= TransformFlags.ContainsClassFields;
return node;
}
// @api
function createPrivateIdentifier(text: string): PrivateIdentifier {
if (!startsWith(text, "#")) Debug.fail("First character of private identifier must be #: " + text);
const node = baseFactory.createBasePrivateIdentifierNode(SyntaxKind.PrivateIdentifier) as Mutable<PrivateIdentifier>;
node.escapedText = escapeLeadingUnderscores(text);
node.transformFlags |= TransformFlags.ContainsClassFields;
return createBasePrivateIdentifier(text);
}
function createBaseGeneratedPrivateIdentifier(text: string, autoGenerateFlags: GeneratedIdentifierFlags, prefix: string | GeneratedNamePart | undefined, suffix: string | undefined) {
const node = createBasePrivateIdentifier(text);
node.autoGenerateFlags = autoGenerateFlags;
node.autoGenerateId = nextAutoGenerateId;
node.autoGeneratePrefix = prefix;
node.autoGenerateSuffix = suffix;
nextAutoGenerateId++;
return node;
}
/** Create a unique name based on the supplied text. */
// @api
function createUniquePrivateName(text?: string, prefix?: string | GeneratedNamePart, suffix?: string): PrivateIdentifier {
if (text && !startsWith(text, "#")) Debug.fail("First character of private identifier must be #: " + text);
const autoGenerateFlags = GeneratedIdentifierFlags.ReservedInNestedScopes |
(text ? GeneratedIdentifierFlags.Unique : GeneratedIdentifierFlags.Auto);
return createBaseGeneratedPrivateIdentifier(text ?? "", autoGenerateFlags, prefix, suffix);
}
// @api
function getGeneratedPrivateNameForNode(node: Node, prefix?: string | GeneratedNamePart, suffix?: string): PrivateIdentifier {
const text = isMemberName(node) ? formatGeneratedName(/*privateName*/ true, prefix, node, suffix, idText) :
`#generated@${getNodeId(node)}`;
const flags = prefix || suffix ? GeneratedIdentifierFlags.Optimistic : GeneratedIdentifierFlags.None;
const name = createBaseGeneratedPrivateIdentifier(text, GeneratedIdentifierFlags.Node | flags, prefix, suffix);
name.original = node;
return name;
}
//
// Punctuation
//
@@ -998,6 +1039,9 @@ namespace ts {
case SyntaxKind.StaticKeyword:
transformFlags = TransformFlags.ContainsES2015;
break;
case SyntaxKind.AccessorKeyword:
transformFlags = TransformFlags.ContainsClassFields;
break;
case SyntaxKind.ThisKeyword:
// 'this' indicates a lexical 'this'
transformFlags = TransformFlags.ContainsLexicalThis;
@@ -1061,6 +1105,7 @@ namespace ts {
if (flags & ModifierFlags.Static) result.push(createModifier(SyntaxKind.StaticKeyword));
if (flags & ModifierFlags.Override) result.push(createModifier(SyntaxKind.OverrideKeyword));
if (flags & ModifierFlags.Readonly) result.push(createModifier(SyntaxKind.ReadonlyKeyword));
if (flags & ModifierFlags.Accessor) result.push(createModifier(SyntaxKind.AccessorKeyword));
if (flags & ModifierFlags.Async) result.push(createModifier(SyntaxKind.AsyncKeyword));
if (flags & ModifierFlags.In) result.push(createModifier(SyntaxKind.InKeyword));
if (flags & ModifierFlags.Out) result.push(createModifier(SyntaxKind.OutKeyword));
+5
View File
@@ -139,6 +139,11 @@ namespace ts {
return node.kind === SyntaxKind.OverrideKeyword;
}
/* @internal */
export function isAccessorModifier(node: Node): node is AccessorKeyword {
return node.kind === SyntaxKind.AccessorKeyword;
}
/*@internal*/
export function isSuperKeyword(node: Node): node is SuperExpression {
return node.kind === SyntaxKind.SuperKeyword;
+3 -1
View File
@@ -177,13 +177,15 @@ namespace ts {
// (a|b)|c -> a|(b|c) -> a|b|c
// (a&b)&c -> a&(b&c) -> a&b&c
// (a^b)^c -> a^(b^c) -> a^b^c
// (a,b),c -> a,(b,c) -> a,b,c
//
// While addition is associative in mathematics, JavaScript's `+` is not
// guaranteed to be associative as it is overloaded with string concatenation.
return binaryOperator === SyntaxKind.AsteriskToken
|| binaryOperator === SyntaxKind.BarToken
|| binaryOperator === SyntaxKind.AmpersandToken
|| binaryOperator === SyntaxKind.CaretToken;
|| binaryOperator === SyntaxKind.CaretToken
|| binaryOperator === SyntaxKind.CommaToken;
}
/**
+137
View File
@@ -1244,4 +1244,141 @@ namespace ts {
if (nodes.length === 0) return nodes;
return setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes);
}
/**
* Gets the node from which a name should be generated.
*/
export function getNodeForGeneratedName(name: GeneratedIdentifier | GeneratedPrivateIdentifier) {
if (name.autoGenerateFlags & GeneratedIdentifierFlags.Node) {
const autoGenerateId = name.autoGenerateId;
let node = name as Node;
let original = node.original;
while (original) {
node = original;
// if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing.
if (isMemberName(node)
&& !!(node.autoGenerateFlags! & GeneratedIdentifierFlags.Node)
&& node.autoGenerateId !== autoGenerateId) {
break;
}
original = node.original;
}
// otherwise, return the original node for the source
return node;
}
return name;
}
/**
* Formats a prefix or suffix of a generated name.
*/
export function formatGeneratedNamePart(part: string | undefined): string;
/**
* Formats a prefix or suffix of a generated name. If the part is a {@link GeneratedNamePart}, calls {@link generateName} to format the source node.
*/
export function formatGeneratedNamePart(part: string | GeneratedNamePart | undefined, generateName: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string): string;
export function formatGeneratedNamePart(part: string | GeneratedNamePart | undefined, generateName?: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string): string {
return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName!) :
typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === CharacterCodes.hash ? part.slice(1) : part :
"";
}
function formatIdentifier(name: string | Identifier | PrivateIdentifier, generateName?: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string) {
return typeof name === "string" ? name :
formatIdentifierWorker(name, Debug.checkDefined(generateName));
}
function formatIdentifierWorker(node: Identifier | PrivateIdentifier, generateName: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string) {
return isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) :
isGeneratedIdentifier(node) ? generateName(node) :
isPrivateIdentifier(node) ? (node.escapedText as string).slice(1) :
idText(node);
}
/**
* Formats a generated name.
* @param privateName When `true`, inserts a `#` character at the start of the result.
* @param prefix The prefix (if any) to include before the base name.
* @param baseName The base name for the generated name.
* @param suffix The suffix (if any) to include after the base name.
*/
export function formatGeneratedName(privateName: boolean, prefix: string | undefined, baseName: string, suffix: string | undefined): string;
/**
* Formats a generated name.
* @param privateName When `true`, inserts a `#` character at the start of the result.
* @param prefix The prefix (if any) to include before the base name.
* @param baseName The base name for the generated name.
* @param suffix The suffix (if any) to include after the base name.
* @param generateName Called to format the source node of {@link prefix} when it is a {@link GeneratedNamePart}.
*/
export function formatGeneratedName(privateName: boolean, prefix: string | GeneratedNamePart | undefined, baseName: string | Identifier | PrivateIdentifier, suffix: string | GeneratedNamePart | undefined, generateName: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string): string;
export function formatGeneratedName(privateName: boolean, prefix: string | GeneratedNamePart | undefined, baseName: string | Identifier | PrivateIdentifier, suffix: string | GeneratedNamePart | undefined, generateName?: (name: GeneratedIdentifier | GeneratedPrivateIdentifier) => string) {
prefix = formatGeneratedNamePart(prefix, generateName!);
suffix = formatGeneratedNamePart(suffix, generateName!);
baseName = formatIdentifier(baseName, generateName);
return `${privateName ? "#" : ""}${prefix}${baseName}${suffix}`;
}
/**
* Creates a private backing field for an `accessor` {@link PropertyDeclaration}.
*/
export function createAccessorPropertyBackingField(factory: NodeFactory, node: PropertyDeclaration, modifiers: ModifiersArray | undefined, initializer: Expression | undefined) {
return factory.updatePropertyDeclaration(
node,
modifiers,
factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"),
/*questionOrExclamationToken*/ undefined,
/*type*/ undefined,
initializer
);
}
/**
* Creates a {@link GetAccessorDeclaration} that reads from a private backing field.
*/
export function createAccessorPropertyGetRedirector(factory: NodeFactory, node: PropertyDeclaration, modifiers: ModifiersArray | undefined, name: PropertyName) {
return factory.createGetAccessorDeclaration(
modifiers,
name,
[],
/*type*/ undefined,
factory.createBlock([
factory.createReturnStatement(
factory.createPropertyAccessExpression(
factory.createThis(),
factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")
)
)
])
);
}
/**
* Creates a {@link SetAccessorDeclaration} that writes to a private backing field.
*/
export function createAccessorPropertySetRedirector(factory: NodeFactory, node: PropertyDeclaration, modifiers: ModifiersArray | undefined, name: PropertyName) {
return factory.createSetAccessorDeclaration(
modifiers,
name,
[factory.createParameterDeclaration(
/*modifiers*/ undefined,
/*dotdotDotToken*/ undefined,
"value"
)],
factory.createBlock([
factory.createExpressionStatement(
factory.createAssignment(
factory.createPropertyAccessExpression(
factory.createThis(),
factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")
),
factory.createIdentifier("value")
)
)
])
);
}
}
+4
View File
@@ -2313,6 +2313,7 @@ namespace ts {
return canFollowExportModifier();
case SyntaxKind.DefaultKeyword:
return nextTokenCanFollowDefaultKeyword();
case SyntaxKind.AccessorKeyword:
case SyntaxKind.StaticKeyword:
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
@@ -6613,6 +6614,7 @@ namespace ts {
case SyntaxKind.NamespaceKeyword:
return nextTokenIsIdentifierOrStringLiteralOnSameLine();
case SyntaxKind.AbstractKeyword:
case SyntaxKind.AccessorKeyword:
case SyntaxKind.AsyncKeyword:
case SyntaxKind.DeclareKeyword:
case SyntaxKind.PrivateKeyword:
@@ -6705,6 +6707,7 @@ namespace ts {
// When these don't start a declaration, they're an identifier in an expression statement
return true;
case SyntaxKind.AccessorKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
@@ -6791,6 +6794,7 @@ namespace ts {
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.AbstractKeyword:
case SyntaxKind.AccessorKeyword:
case SyntaxKind.StaticKeyword:
case SyntaxKind.ReadonlyKeyword:
case SyntaxKind.GlobalKeyword:
+4 -1
View File
@@ -2413,7 +2413,9 @@ namespace ts {
// Check modifiers of property declaration
if (nodes === (parent as PropertyDeclaration).modifiers) {
for (const modifier of nodes as NodeArray<ModifierLike>) {
if (isModifier(modifier) && modifier.kind !== SyntaxKind.StaticKeyword) {
if (isModifier(modifier)
&& modifier.kind !== SyntaxKind.StaticKeyword
&& modifier.kind !== SyntaxKind.AccessorKeyword) {
diagnostics.push(createDiagnosticForNode(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind)));
}
}
@@ -2467,6 +2469,7 @@ namespace ts {
case SyntaxKind.StaticKeyword:
case SyntaxKind.ExportKeyword:
case SyntaxKind.DefaultKeyword:
case SyntaxKind.AccessorKeyword:
}
}
}
+1
View File
@@ -80,6 +80,7 @@ namespace ts {
/** @internal */
export const textToKeywordObj: MapLike<KeywordSyntaxKind> = {
abstract: SyntaxKind.AbstractKeyword,
accessor: SyntaxKind.AccessorKeyword,
any: SyntaxKind.AnyKeyword,
as: SyntaxKind.AsKeyword,
asserts: SyntaxKind.AssertsKeyword,
File diff suppressed because it is too large. Load diff
@@ -503,7 +503,7 @@ namespace ts {
const prefix = getClassMemberPrefix(node, member);
const memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !hasSyntacticModifier(member, ModifierFlags.Ambient));
const descriptor = languageVersion > ScriptTarget.ES3
? member.kind === SyntaxKind.PropertyDeclaration
? isPropertyDeclaration(member) && !hasAccessorModifier(member)
// We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it
// should not invoke `Object.getOwnPropertyDescriptor`.
? factory.createVoidZero()
+2 -2
View File
@@ -381,8 +381,8 @@ namespace ts {
*
* @param member The class element node.
*/
export function isNonStaticMethodOrAccessorWithPrivateName(member: ClassElement): member is PrivateIdentifierMethodDeclaration | PrivateIdentifierAccessorDeclaration {
return !isStatic(member) && isMethodOrAccessor(member) && isPrivateIdentifier(member.name);
export function isNonStaticMethodOrAccessorWithPrivateName(member: ClassElement): member is PrivateIdentifierMethodDeclaration | PrivateIdentifierAccessorDeclaration | PrivateIdentifierAutoAccessorPropertyDeclaration {
return !isStatic(member) && (isMethodOrAccessor(member) || isAutoAccessorPropertyDeclaration(member)) && isPrivateIdentifier(member.name);
}
/**
+50 -7
View File
@@ -159,6 +159,7 @@ namespace ts {
YieldKeyword,
// Contextual keywords
AbstractKeyword,
AccessorKeyword,
AsKeyword,
AssertsKeyword,
AssertKeyword,
@@ -550,6 +551,7 @@ namespace ts {
export type KeywordSyntaxKind =
| SyntaxKind.AbstractKeyword
| SyntaxKind.AccessorKeyword
| SyntaxKind.AnyKeyword
| SyntaxKind.AsKeyword
| SyntaxKind.AssertsKeyword
@@ -634,6 +636,7 @@ namespace ts {
export type ModifierSyntaxKind =
| SyntaxKind.AbstractKeyword
| SyntaxKind.AccessorKeyword
| SyntaxKind.AsyncKeyword
| SyntaxKind.ConstKeyword
| SyntaxKind.DeclareKeyword
@@ -817,9 +820,10 @@ namespace ts {
Protected = 1 << 4, // Property/Method
Static = 1 << 5, // Property/Method
Readonly = 1 << 6, // Property/Method
Abstract = 1 << 7, // Class/Method/ConstructSignature
Async = 1 << 8, // Property/Method/Function
Default = 1 << 9, // Function/Class (export default declaration)
Accessor = 1 << 7, // Property
Abstract = 1 << 8, // Class/Method/ConstructSignature
Async = 1 << 9, // Property/Method/Function
Default = 1 << 10, // Function/Class (export default declaration)
Const = 1 << 11, // Const enum
HasComputedJSDocModifiers = 1 << 12, // Indicates the computed modifier flags include modifiers from JSDoc.
@@ -837,7 +841,7 @@ namespace ts {
TypeScriptModifier = Ambient | Public | Private | Protected | Readonly | Abstract | Const | Override | In | Out,
ExportDefault = Export | Default,
All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Async | Default | Const | Deprecated | Override | In | Out | Decorator,
All = Export | Ambient | Public | Private | Protected | Static | Readonly | Abstract | Accessor | Async | Default | Const | Deprecated | Override | In | Out | Decorator,
Modifier = All & ~Decorator
}
@@ -1332,6 +1336,7 @@ namespace ts {
}
export type AbstractKeyword = ModifierToken<SyntaxKind.AbstractKeyword>;
export type AccessorKeyword = ModifierToken<SyntaxKind.AccessorKeyword>;
export type AsyncKeyword = ModifierToken<SyntaxKind.AsyncKeyword>;
export type ConstKeyword = ModifierToken<SyntaxKind.ConstKeyword>;
export type DeclareKeyword = ModifierToken<SyntaxKind.DeclareKeyword>;
@@ -1351,6 +1356,7 @@ namespace ts {
export type Modifier =
| AbstractKeyword
| AccessorKeyword
| AsyncKeyword
| ConstKeyword
| DeclareKeyword
@@ -1383,6 +1389,7 @@ namespace ts {
| AccessibilityModifier
| ReadonlyKeyword
| StaticKeyword
| AccessorKeyword
;
export type ModifiersArray = NodeArray<Modifier>;
@@ -1413,6 +1420,8 @@ namespace ts {
readonly originalKeywordKind?: SyntaxKind; // Original syntaxKind which get set so that we can report an error later
/*@internal*/ readonly autoGenerateFlags?: GeneratedIdentifierFlags; // Specifies whether to auto-generate the text for an identifier.
/*@internal*/ readonly autoGenerateId?: number; // Ensures unique generated identifiers get unique names, but clones get the same name.
/*@internal*/ readonly autoGeneratePrefix?: string | GeneratedNamePart;
/*@internal*/ readonly autoGenerateSuffix?: string;
/*@internal*/ generatedImportReference?: ImportSpecifier; // Reference to the generated import specifier this identifier refers to
isInJSDocNamespace?: boolean; // if the node is a member in a JSDoc namespace
/*@internal*/ typeArguments?: NodeArray<TypeNode | TypeParameterDeclaration>; // Only defined on synthesized nodes. Though not syntactically valid, used in emitting diagnostics, quickinfo, and signature help.
@@ -1502,8 +1511,16 @@ namespace ts {
// escaping not strictly necessary
// avoids gotchas in transforms and utils
readonly escapedText: __String;
/*@internal*/ readonly autoGenerateFlags?: GeneratedIdentifierFlags; // Specifies whether to auto-generate the text for an identifier.
/*@internal*/ readonly autoGenerateId?: number; // Ensures unique generated identifiers get unique names, but clones get the same name.
/*@internal*/ readonly autoGeneratePrefix?: string | GeneratedNamePart;
/*@internal*/ readonly autoGenerateSuffix?: string;
}
/*@internal*/
export interface GeneratedPrivateIdentifier extends PrivateIdentifier {
autoGenerateFlags: GeneratedIdentifierFlags;
}
/* @internal */
// A name that supports late-binding (used in checker)
@@ -1627,11 +1644,19 @@ namespace ts {
readonly initializer?: Expression; // Optional initializer
}
export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration {
_autoAccessorBrand: any;
}
/*@internal*/
export interface PrivateIdentifierPropertyDeclaration extends PropertyDeclaration {
name: PrivateIdentifier;
}
/*@internal*/
export interface PrivateIdentifierAutoAccessorPropertyDeclaration extends AutoAccessorPropertyDeclaration {
name: PrivateIdentifier;
}
/*@internal*/
export interface PrivateIdentifierMethodDeclaration extends MethodDeclaration {
name: PrivateIdentifier;
}
@@ -1648,6 +1673,7 @@ namespace ts {
/*@internal*/
export type PrivateClassElementDeclaration =
| PrivateIdentifierPropertyDeclaration
| PrivateIdentifierAutoAccessorPropertyDeclaration
| PrivateIdentifierMethodDeclaration
| PrivateIdentifierGetAccessorDeclaration
| PrivateIdentifierSetAccessorDeclaration;
@@ -2051,7 +2077,7 @@ namespace ts {
export interface StringLiteral extends LiteralExpression, Declaration {
readonly kind: SyntaxKind.StringLiteral;
/* @internal */ readonly textSourceNode?: Identifier | StringLiteralLike | NumericLiteral; // Allows a StringLiteral to get its text from another node (used by transforms).
/* @internal */ readonly textSourceNode?: Identifier | StringLiteralLike | NumericLiteral | PrivateIdentifier; // Allows a StringLiteral to get its text from another node (used by transforms).
/** Note: this is only set when synthesizing a node, not during parsing. */
/* @internal */ readonly singleQuote?: boolean;
}
@@ -5287,6 +5313,7 @@ namespace ts {
MethodExcludes = Value & ~Method,
GetAccessorExcludes = Value & ~SetAccessor,
SetAccessorExcludes = Value & ~GetAccessor,
AccessorExcludes = Value & ~Accessor,
TypeParameterExcludes = Type & ~TypeParameter,
TypeAliasExcludes = Type,
AliasExcludes = Alias,
@@ -7590,6 +7617,15 @@ namespace ts {
convertToAssignmentElementTarget(node: BindingOrAssignmentElementTarget): Expression;
}
/* @internal */
export interface GeneratedNamePart {
/** an additional prefix to insert before the text sourced from `node` */
prefix?: string;
node: Identifier | PrivateIdentifier;
/** an additional suffix to insert after the text sourced from `node` */
suffix?: string;
}
export interface NodeFactory {
/* @internal */ readonly parenthesizer: ParenthesizerRules;
/* @internal */ readonly converters: NodeConverters;
@@ -7605,7 +7641,7 @@ namespace ts {
createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral;
createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral;
/* @internal*/ createStringLiteral(text: string, isSingleQuote?: boolean, hasExtendedUnicodeEscape?: boolean): StringLiteral; // eslint-disable-line @typescript-eslint/unified-signatures
createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral;
createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral;
createRegularExpressionLiteral(text: string): RegularExpressionLiteral;
//
@@ -7626,6 +7662,7 @@ namespace ts {
* setting `EmitFlags.ReuseTempVariableScope` on the nested function itself.
*/
createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes?: boolean): Identifier;
/*@internal*/ createTempVariable(recordTempVariable: ((node: Identifier) => void) | undefined, reservedInNestedScopes?: boolean, prefix?: string | GeneratedNamePart, suffix?: string): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures
/**
* Create a unique temporary variable for use in a loop.
@@ -7637,11 +7674,17 @@ namespace ts {
/** Create a unique name based on the supplied text. */
createUniqueName(text: string, flags?: GeneratedIdentifierFlags): Identifier;
/*@internal*/ createUniqueName(text: string, flags?: GeneratedIdentifierFlags, prefix?: string | GeneratedNamePart, suffix?: string): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures
/** Create a unique name generated for a node. */
getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier;
/*@internal*/ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags, prefix?: string | GeneratedNamePart, suffix?: string): Identifier; // eslint-disable-line @typescript-eslint/unified-signatures
createPrivateIdentifier(text: string): PrivateIdentifier
createUniquePrivateName(text?: string): PrivateIdentifier;
/*@internal*/ createUniquePrivateName(text?: string, prefix?: string | GeneratedNamePart, suffix?: string): PrivateIdentifier; // eslint-disable-line @typescript-eslint/unified-signatures
getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier;
/*@internal*/ getGeneratedPrivateNameForNode(node: Node, prefix?: string | GeneratedNamePart, suffix?: string): PrivateIdentifier; // eslint-disable-line @typescript-eslint/unified-signatures
//
// Punctuation
@@ -8508,7 +8551,7 @@ namespace ts {
<T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined;
}
export type VisitResult<T extends Node> = T | T[] | undefined;
export type VisitResult<T extends Node> = T | readonly T[] | undefined;
export interface Printer {
/**
+11 -6
View File
@@ -853,6 +853,10 @@ namespace ts {
return false;
}
export function isAmbientPropertyDeclaration(node: PropertyDeclaration) {
return !!(node.flags & NodeFlags.Ambient) || hasSyntacticModifier(node, ModifierFlags.Ambient);
}
export function isBlockScope(node: Node, parentNode: Node | undefined): boolean {
switch (node.kind) {
case SyntaxKind.SourceFile:
@@ -996,7 +1000,7 @@ namespace ts {
switch (name.kind) {
case SyntaxKind.Identifier:
case SyntaxKind.PrivateIdentifier:
return name.escapedText;
return name.autoGenerateFlags ? undefined : name.escapedText;
case SyntaxKind.StringLiteral:
case SyntaxKind.NumericLiteral:
case SyntaxKind.NoSubstitutionTemplateLiteral:
@@ -3407,7 +3411,7 @@ namespace ts {
return false;
}
}
export function getTextOfIdentifierOrLiteral(node: PropertyNameLiteral): string {
export function getTextOfIdentifierOrLiteral(node: PropertyNameLiteral | PrivateIdentifier): string {
return isMemberName(node) ? idText(node) : node.text;
}
@@ -4922,6 +4926,10 @@ namespace ts {
return hasSyntacticModifier(node, ModifierFlags.Ambient);
}
export function hasAccessorModifier(node: Node): boolean {
return hasSyntacticModifier(node, ModifierFlags.Accessor);
}
export function hasEffectiveReadonlyModifier(node: Node): boolean {
return hasEffectiveModifier(node, ModifierFlags.Readonly);
}
@@ -5031,6 +5039,7 @@ namespace ts {
case SyntaxKind.ProtectedKeyword: return ModifierFlags.Protected;
case SyntaxKind.PrivateKeyword: return ModifierFlags.Private;
case SyntaxKind.AbstractKeyword: return ModifierFlags.Abstract;
case SyntaxKind.AccessorKeyword: return ModifierFlags.Accessor;
case SyntaxKind.ExportKeyword: return ModifierFlags.Export;
case SyntaxKind.DeclareKeyword: return ModifierFlags.Ambient;
case SyntaxKind.ConstKeyword: return ModifierFlags.Const;
@@ -5045,10 +5054,6 @@ namespace ts {
return ModifierFlags.None;
}
export function createModifiers(modifierFlags: ModifierFlags): ModifiersArray | undefined {
return modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : undefined;
}
export function isLogicalOperator(token: SyntaxKind): boolean {
return token === SyntaxKind.BarBarToken
|| token === SyntaxKind.AmpersandAmpersandToken
+27 -1
View File
@@ -1199,6 +1199,11 @@ namespace ts {
return isIdentifier(node) && (node.autoGenerateFlags! & GeneratedIdentifierFlags.KindMask) > GeneratedIdentifierFlags.None;
}
/* @internal */
export function isGeneratedPrivateIdentifier(node: Node): node is GeneratedPrivateIdentifier {
return isPrivateIdentifier(node) && (node.autoGenerateFlags! & GeneratedIdentifierFlags.KindMask) > GeneratedIdentifierFlags.None;
}
// Private Identifiers
/*@internal*/
export function isPrivateIdentifierClassElementDeclaration(node: Node): node is PrivateClassElementDeclaration {
@@ -1216,6 +1221,7 @@ namespace ts {
export function isModifierKind(token: SyntaxKind): token is Modifier["kind"] {
switch (token) {
case SyntaxKind.AbstractKeyword:
case SyntaxKind.AccessorKeyword:
case SyntaxKind.AsyncKeyword:
case SyntaxKind.ConstKeyword:
case SyntaxKind.DeclareKeyword:
@@ -1241,7 +1247,10 @@ namespace ts {
/* @internal */
export function isClassMemberModifier(idToken: SyntaxKind): boolean {
return isParameterPropertyModifier(idToken) || idToken === SyntaxKind.StaticKeyword || idToken === SyntaxKind.OverrideKeyword;
return isParameterPropertyModifier(idToken) ||
idToken === SyntaxKind.StaticKeyword ||
idToken === SyntaxKind.OverrideKeyword ||
idToken === SyntaxKind.AccessorKeyword;
}
export function isModifier(node: Node): node is Modifier {
@@ -1349,6 +1358,10 @@ namespace ts {
return node && (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor);
}
export function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration {
return isPropertyDeclaration(node) && hasAccessorModifier(node);
}
/* @internal */
export function isMethodOrAccessor(node: Node): node is MethodDeclaration | AccessorDeclaration {
switch (node.kind) {
@@ -1361,6 +1374,19 @@ namespace ts {
}
}
/* @internal */
export function isNamedClassElement(node: Node): node is MethodDeclaration | AccessorDeclaration | PropertyDeclaration {
switch (node.kind) {
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
case SyntaxKind.PropertyDeclaration:
return true;
default:
return false;
}
}
// Type members
export function isModifierLike(node: Node): node is ModifierLike {
+14 -1
View File
@@ -44,6 +44,9 @@ namespace ts {
return visitedNode as T;
}
/* @internal */
export function visitNodes<T extends Node, U extends T>(nodes: NodeArray<T>, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): NodeArray<U>;
/**
* Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
*
@@ -55,6 +58,9 @@ namespace ts {
*/
export function visitNodes<T extends Node>(nodes: NodeArray<T>, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>;
/* @internal */
export function visitNodes<T extends Node, U extends T>(nodes: NodeArray<T> | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): NodeArray<U> | undefined;
/**
* Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
*
@@ -116,7 +122,14 @@ namespace ts {
}
/* @internal */
export function visitArray<T extends Node, U extends T>(nodes: readonly T[] | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): readonly U[] | undefined {
export function visitArray<T extends Node, U extends T>(nodes: T[] | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): U[] | undefined;
/* @internal */
export function visitArray<T extends Node, U extends T>(nodes: readonly T[] | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): readonly U[] | undefined;
/* @internal */
export function visitArray<T extends Node>(nodes: T[] | undefined, visitor: Visitor, test: (node: Node) => node is T, start?: number, count?: number): T[] | undefined;
/* @internal */
export function visitArray<T extends Node>(nodes: readonly T[] | undefined, visitor: Visitor, test: (node: Node) => node is T, start?: number, count?: number): readonly T[] | undefined;
export function visitArray<T extends Node, U extends T>(nodes: readonly T[] | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number) {
if (nodes === undefined) {
return nodes;
}
@@ -30,7 +30,7 @@ namespace ts {
export const createLoopVariable = Debug.deprecate(factory.createLoopVariable, factoryDeprecation);
/** @deprecated Use `factory.createUniqueName` or the factory supplied by your transformation context instead. */
export const createUniqueName = Debug.deprecate(factory.createUniqueName, factoryDeprecation);
export const createUniqueName: (text: string, flags?: GeneratedIdentifierFlags | undefined) => Identifier = Debug.deprecate(factory.createUniqueName, factoryDeprecation);
/** @deprecated Use `factory.createPrivateIdentifier` or the factory supplied by your transformation context instead. */
export const createPrivateIdentifier = Debug.deprecate(factory.createPrivateIdentifier, factoryDeprecation);
+1
View File
@@ -1271,6 +1271,7 @@ namespace FourSlashInterface {
export const classElementKeywords: readonly ExpectedCompletionEntryObject[] = [
"abstract",
"accessor",
"async",
"constructor",
"declare",
+1
View File
@@ -320,6 +320,7 @@ namespace ts {
case SyntaxKind.SetKeyword:
case SyntaxKind.ConstructorKeyword:
case SyntaxKind.StaticKeyword:
case SyntaxKind.AccessorKeyword:
return true; // Allow things like "public get", "public constructor" and "public static".
default:
return false; // Any other keyword following "public" is actually an identifier, not a real keyword.
+6 -6
View File
@@ -29,18 +29,18 @@ namespace ts.codefix {
suppressLeadingAndTrailingTrivia(declaration);
suppressLeadingAndTrailingTrivia(container);
let accessorModifiers: NodeArray<ModifierLike> | undefined;
let accessorModifiers: readonly ModifierLike[] | undefined;
let fieldModifiers: readonly ModifierLike[] | undefined;
if (isClassLike(container)) {
const modifierFlags = getEffectiveModifierFlags(declaration);
if (isSourceFileJS(file)) {
const modifiers = createModifiers(modifierFlags);
const modifiers = factory.createModifiersFromModifierFlags(modifierFlags);
accessorModifiers = modifiers;
fieldModifiers = modifiers;
}
else {
accessorModifiers = createModifiers(prepareModifierFlagsForAccessor(modifierFlags));
fieldModifiers = createModifiers(prepareModifierFlagsForField(modifierFlags));
accessorModifiers = factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags));
fieldModifiers = factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags));
}
if (canHaveDecorators(declaration)) {
fieldModifiers = concatenate(getDecorators(declaration), fieldModifiers);
@@ -146,7 +146,7 @@ namespace ts.codefix {
};
}
function generateGetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode | undefined, modifiers: NodeArray<ModifierLike> | undefined, isStatic: boolean, container: ContainerDeclaration) {
function generateGetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode | undefined, modifiers: readonly ModifierLike[] | undefined, isStatic: boolean, container: ContainerDeclaration) {
return factory.createGetAccessorDeclaration(
modifiers,
accessorName,
@@ -160,7 +160,7 @@ namespace ts.codefix {
);
}
function generateSetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode | undefined, modifiers: NodeArray<ModifierLike> | undefined, isStatic: boolean, container: ContainerDeclaration) {
function generateSetAccessor(fieldName: AcceptedNameType, accessorName: AcceptedNameType, type: TypeNode | undefined, modifiers: readonly ModifierLike[] | undefined, isStatic: boolean, container: ContainerDeclaration) {
return factory.createSetAccessorDeclaration(
modifiers,
accessorName,
+17 -23
View File
@@ -79,8 +79,16 @@ namespace ts.codefix {
* In such cases, we assume the declaration to be a `PropertySignature`.
*/
const kind = declaration?.kind ?? SyntaxKind.PropertySignature;
const declarationName = getNameOfDeclaration(declaration) as PropertyName;
const visibilityModifier = createVisibilityModifier(declaration ? getEffectiveModifierFlags(declaration) : ModifierFlags.None);
const declarationName = getSynthesizedDeepClone(getNameOfDeclaration(declaration), /*includeTrivia*/ false) as PropertyName;
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : ModifierFlags.None;
let modifierFlags =
effectiveModifierFlags & ModifierFlags.Public ? ModifierFlags.Public :
effectiveModifierFlags & ModifierFlags.Protected ? ModifierFlags.Protected :
ModifierFlags.None;
if (declaration && isAutoAccessorPropertyDeclaration(declaration)) {
modifierFlags |= ModifierFlags.Accessor;
}
const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : undefined;
const type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
const optional = !!(symbol.flags & SymbolFlags.Optional);
const ambient = !!(enclosingDeclaration.flags & NodeFlags.Ambient) || isAmbient;
@@ -99,7 +107,7 @@ namespace ts.codefix {
}
}
addClassElement(factory.createPropertyDeclaration(
createModifiers(visibilityModifier),
modifiers,
declaration ? createName(declarationName) : symbol.getName(),
optional && (preserveOptional & PreserveOptionalFlags.Property) ? factory.createToken(SyntaxKind.QuestionToken) : undefined,
typeNode,
@@ -123,7 +131,7 @@ namespace ts.codefix {
for (const accessor of orderedAccessors) {
if (isGetAccessorDeclaration(accessor)) {
addClassElement(factory.createGetAccessorDeclaration(
createModifiers(visibilityModifier),
modifiers,
createName(declarationName),
emptyArray,
createTypeNode(typeNode),
@@ -134,7 +142,7 @@ namespace ts.codefix {
const parameter = getSetAccessorValueParameter(accessor);
const parameterName = parameter && isIdentifier(parameter.name) ? idText(parameter.name) : undefined;
addClassElement(factory.createSetAccessorDeclaration(
createModifiers(visibilityModifier),
modifiers,
createName(declarationName),
createDummyParameters(1, [parameterName], [createTypeNode(typeNode)], 1, /*inJs*/ false),
createBody(body, quotePreference, ambient)));
@@ -160,23 +168,23 @@ namespace ts.codefix {
if (declarations.length === 1) {
Debug.assert(signatures.length === 1, "One declaration implies one signature");
const signature = signatures[0];
outputMethod(quotePreference, signature, createModifiers(visibilityModifier), createName(declarationName), createBody(body, quotePreference, ambient));
outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient));
break;
}
for (const signature of signatures) {
// Ensure nodes are fresh so they can have different positions when going through formatting.
outputMethod(quotePreference, signature, createModifiers(visibilityModifier), createName(declarationName));
outputMethod(quotePreference, signature, modifiers, createName(declarationName));
}
if (!ambient) {
if (declarations.length > signatures.length) {
const signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1] as SignatureDeclaration)!;
outputMethod(quotePreference, signature, createModifiers(visibilityModifier), createName(declarationName), createBody(body, quotePreference));
outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference));
}
else {
Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count");
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & PreserveOptionalFlags.Method), createModifiers(visibilityModifier), quotePreference, body));
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & PreserveOptionalFlags.Method), modifiers, quotePreference, body));
}
}
break;
@@ -191,10 +199,6 @@ namespace ts.codefix {
return getSynthesizedDeepClone(node, /*includeTrivia*/ false);
}
function createModifiers(modifier: Modifier | undefined) {
return modifier ? factory.createNodeArray([modifier]) : undefined;
}
function createBody(block: Block | undefined, quotePreference: QuotePreference, ambient?: boolean) {
return ambient ? undefined :
getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference);
@@ -644,16 +648,6 @@ namespace ts.codefix {
/*multiline*/ true);
}
function createVisibilityModifier(flags: ModifierFlags): Modifier | undefined {
if (flags & ModifierFlags.Public) {
return factory.createToken(SyntaxKind.PublicKeyword);
}
else if (flags & ModifierFlags.Protected) {
return factory.createToken(SyntaxKind.ProtectedKeyword);
}
return undefined;
}
export function setJsonCompilerOptionValues(
changeTracker: textChanges.ChangeTracker,
configFile: TsConfigSourceFile,
+1
View File
@@ -3949,6 +3949,7 @@ namespace ts.Completions {
function isClassMemberCompletionKeyword(kind: SyntaxKind) {
switch (kind) {
case SyntaxKind.AbstractKeyword:
case SyntaxKind.AccessorKeyword:
case SyntaxKind.ConstructorKeyword:
case SyntaxKind.GetKeyword:
case SyntaxKind.SetKeyword:
+1
View File
@@ -149,6 +149,7 @@ namespace ts.formatting {
"SpaceAfterCertainTypeScriptKeywords",
[
SyntaxKind.AbstractKeyword,
SyntaxKind.AccessorKeyword,
SyntaxKind.ClassKeyword,
SyntaxKind.DeclareKeyword,
SyntaxKind.DefaultKeyword,
+5 -1
View File
@@ -159,7 +159,7 @@ namespace ts.SymbolDisplay {
if (symbolKind !== ScriptElementKind.unknown || symbolFlags & SymbolFlags.Class || symbolFlags & SymbolFlags.Alias) {
// If symbol is accessor, they are allowed only if location is at declaration identifier of the accessor
if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) {
const declaration = find(symbol.declarations as ((GetAccessorDeclaration | SetAccessorDeclaration)[]), declaration => declaration.name === location);
const declaration = find(symbol.declarations as ((GetAccessorDeclaration | SetAccessorDeclaration | PropertyDeclaration)[]), declaration => declaration.name === location);
if (declaration) {
switch(declaration.kind){
case SyntaxKind.GetAccessor:
@@ -168,6 +168,9 @@ namespace ts.SymbolDisplay {
case SyntaxKind.SetAccessor:
symbolKind = ScriptElementKind.memberSetAccessorElement;
break;
case SyntaxKind.PropertyDeclaration:
symbolKind = ScriptElementKind.memberAccessorVariableElement;
break;
default:
Debug.assertNever(declaration);
}
@@ -509,6 +512,7 @@ namespace ts.SymbolDisplay {
}
// For properties, variables and local vars: show the type
if (symbolKind === ScriptElementKind.memberVariableElement ||
symbolKind === ScriptElementKind.memberAccessorVariableElement ||
symbolKind === ScriptElementKind.memberGetAccessorElement ||
symbolKind === ScriptElementKind.memberSetAccessorElement ||
symbolKind === ScriptElementKind.jsxAttribute ||
+3
View File
@@ -1467,6 +1467,9 @@ namespace ts {
*/
memberVariableElement = "property",
/** class X { [public|private]* accessor foo: number; } */
memberAccessorVariableElement = "accessor",
/**
* class X { constructor() { } }
* class X { static { } }
+1
View File
@@ -89,6 +89,7 @@
"unittests/evaluation/arraySpread.ts",
"unittests/evaluation/asyncArrow.ts",
"unittests/evaluation/asyncGenerator.ts",
"unittests/evaluation/autoAccessors.ts",
"unittests/evaluation/awaiter.ts",
"unittests/evaluation/destructuring.ts",
"unittests/evaluation/externalModules.ts",
@@ -0,0 +1,113 @@
describe("unittests:: evaluation:: autoAccessors", () => {
const editions = [
{ name: "es2022", target: ts.ScriptTarget.ES2022 },
{ name: "es2015", target: ts.ScriptTarget.ES2015 },
];
for (const { name, target } of editions) {
describe(name, () => {
it("generates accessor pair", async () => {
const { C } = evaluator.evaluateTypeScript(`
export class C {
accessor x;
}
`, { target });
const desc = Object.getOwnPropertyDescriptor(C.prototype, "x");
assert.isDefined(desc);
assert.isFunction(desc!.get);
assert.isFunction(desc!.set);
});
it("storage is private", async () => {
const { C } = evaluator.evaluateTypeScript(`
export class C {
accessor x;
}
`, { target });
const desc = Object.getOwnPropertyDescriptor(C.prototype, "x");
const obj = Object.create(C.prototype);
assert.throws(() => desc!.get!.call(obj), /private/);
});
it("getter and setter wrap same field", async () => {
const { C } = evaluator.evaluateTypeScript(`
export class C {
accessor x;
}
`, { target });
const obj = new C();
obj.x = 1;
assert.equal(obj.x, 1);
obj.x = 2;
assert.equal(obj.x, 2);
});
it("supports initializer", async () => {
const { C } = evaluator.evaluateTypeScript(`
export class C {
accessor x = 1;
}
`, { target });
const obj = new C();
assert.equal(obj.x, 1);
});
it("legacy decorator can intercept getter/setter", async () => {
const { actions, C } = evaluator.evaluateTypeScript(`
function dec(target, key, descriptor) {
const { get, set } = descriptor;
actions.push({ kind: "decorate", target, key });
descriptor.get = function() {
actions.push({ kind: "get", this: this });
return get.call(this);
};
descriptor.set = function(value) {
actions.push({ kind: "set", this: this, value });
set.call(this, value);
};
}
export const actions = [];
export class C {
@dec
accessor x;
}
`, { target, experimentalDecorators: true });
assert.deepEqual(actions, [
{ kind: "decorate", target: C.prototype, key: "x" }
]);
const obj = new C();
obj.x = 1;
assert.equal(obj.x, 1);
assert.deepEqual(actions, [
{ kind: "decorate", target: C.prototype, key: "x" },
{ kind: "set", this: obj, value: 1 },
{ kind: "get", this: obj },
]);
});
it("legacy decorator cannot intercept initializer", async () => {
const { actions, C } = evaluator.evaluateTypeScript(`
function dec(target, key, descriptor) {
const { get, set } = descriptor;
descriptor.set = function(value) {
actions.push({ kind: "set", this: this, value });
set.call(this, value);
};
}
export const actions = [];
export class C {
@dec
accessor x = 1;
}
`, { target, experimentalDecorators: true });
const obj = new C();
assert.equal(obj.x, 1);
assert.deepEqual(actions, []);
});
});
}
});
+269 -257
View File
@@ -232,239 +232,240 @@ declare namespace ts {
StaticKeyword = 124,
YieldKeyword = 125,
AbstractKeyword = 126,
AsKeyword = 127,
AssertsKeyword = 128,
AssertKeyword = 129,
AnyKeyword = 130,
AsyncKeyword = 131,
AwaitKeyword = 132,
BooleanKeyword = 133,
ConstructorKeyword = 134,
DeclareKeyword = 135,
GetKeyword = 136,
InferKeyword = 137,
IntrinsicKeyword = 138,
IsKeyword = 139,
KeyOfKeyword = 140,
ModuleKeyword = 141,
NamespaceKeyword = 142,
NeverKeyword = 143,
OutKeyword = 144,
ReadonlyKeyword = 145,
RequireKeyword = 146,
NumberKeyword = 147,
ObjectKeyword = 148,
SatisfiesKeyword = 149,
SetKeyword = 150,
StringKeyword = 151,
SymbolKeyword = 152,
TypeKeyword = 153,
UndefinedKeyword = 154,
UniqueKeyword = 155,
UnknownKeyword = 156,
FromKeyword = 157,
GlobalKeyword = 158,
BigIntKeyword = 159,
OverrideKeyword = 160,
OfKeyword = 161,
QualifiedName = 162,
ComputedPropertyName = 163,
TypeParameter = 164,
Parameter = 165,
Decorator = 166,
PropertySignature = 167,
PropertyDeclaration = 168,
MethodSignature = 169,
MethodDeclaration = 170,
ClassStaticBlockDeclaration = 171,
Constructor = 172,
GetAccessor = 173,
SetAccessor = 174,
CallSignature = 175,
ConstructSignature = 176,
IndexSignature = 177,
TypePredicate = 178,
TypeReference = 179,
FunctionType = 180,
ConstructorType = 181,
TypeQuery = 182,
TypeLiteral = 183,
ArrayType = 184,
TupleType = 185,
OptionalType = 186,
RestType = 187,
UnionType = 188,
IntersectionType = 189,
ConditionalType = 190,
InferType = 191,
ParenthesizedType = 192,
ThisType = 193,
TypeOperator = 194,
IndexedAccessType = 195,
MappedType = 196,
LiteralType = 197,
NamedTupleMember = 198,
TemplateLiteralType = 199,
TemplateLiteralTypeSpan = 200,
ImportType = 201,
ObjectBindingPattern = 202,
ArrayBindingPattern = 203,
BindingElement = 204,
ArrayLiteralExpression = 205,
ObjectLiteralExpression = 206,
PropertyAccessExpression = 207,
ElementAccessExpression = 208,
CallExpression = 209,
NewExpression = 210,
TaggedTemplateExpression = 211,
TypeAssertionExpression = 212,
ParenthesizedExpression = 213,
FunctionExpression = 214,
ArrowFunction = 215,
DeleteExpression = 216,
TypeOfExpression = 217,
VoidExpression = 218,
AwaitExpression = 219,
PrefixUnaryExpression = 220,
PostfixUnaryExpression = 221,
BinaryExpression = 222,
ConditionalExpression = 223,
TemplateExpression = 224,
YieldExpression = 225,
SpreadElement = 226,
ClassExpression = 227,
OmittedExpression = 228,
ExpressionWithTypeArguments = 229,
AsExpression = 230,
NonNullExpression = 231,
MetaProperty = 232,
SyntheticExpression = 233,
SatisfiesExpression = 234,
TemplateSpan = 235,
SemicolonClassElement = 236,
Block = 237,
EmptyStatement = 238,
VariableStatement = 239,
ExpressionStatement = 240,
IfStatement = 241,
DoStatement = 242,
WhileStatement = 243,
ForStatement = 244,
ForInStatement = 245,
ForOfStatement = 246,
ContinueStatement = 247,
BreakStatement = 248,
ReturnStatement = 249,
WithStatement = 250,
SwitchStatement = 251,
LabeledStatement = 252,
ThrowStatement = 253,
TryStatement = 254,
DebuggerStatement = 255,
VariableDeclaration = 256,
VariableDeclarationList = 257,
FunctionDeclaration = 258,
ClassDeclaration = 259,
InterfaceDeclaration = 260,
TypeAliasDeclaration = 261,
EnumDeclaration = 262,
ModuleDeclaration = 263,
ModuleBlock = 264,
CaseBlock = 265,
NamespaceExportDeclaration = 266,
ImportEqualsDeclaration = 267,
ImportDeclaration = 268,
ImportClause = 269,
NamespaceImport = 270,
NamedImports = 271,
ImportSpecifier = 272,
ExportAssignment = 273,
ExportDeclaration = 274,
NamedExports = 275,
NamespaceExport = 276,
ExportSpecifier = 277,
MissingDeclaration = 278,
ExternalModuleReference = 279,
JsxElement = 280,
JsxSelfClosingElement = 281,
JsxOpeningElement = 282,
JsxClosingElement = 283,
JsxFragment = 284,
JsxOpeningFragment = 285,
JsxClosingFragment = 286,
JsxAttribute = 287,
JsxAttributes = 288,
JsxSpreadAttribute = 289,
JsxExpression = 290,
CaseClause = 291,
DefaultClause = 292,
HeritageClause = 293,
CatchClause = 294,
AssertClause = 295,
AssertEntry = 296,
ImportTypeAssertionContainer = 297,
PropertyAssignment = 298,
ShorthandPropertyAssignment = 299,
SpreadAssignment = 300,
EnumMember = 301,
UnparsedPrologue = 302,
UnparsedPrepend = 303,
UnparsedText = 304,
UnparsedInternalText = 305,
UnparsedSyntheticReference = 306,
SourceFile = 307,
Bundle = 308,
UnparsedSource = 309,
InputFiles = 310,
JSDocTypeExpression = 311,
JSDocNameReference = 312,
JSDocMemberName = 313,
JSDocAllType = 314,
JSDocUnknownType = 315,
JSDocNullableType = 316,
JSDocNonNullableType = 317,
JSDocOptionalType = 318,
JSDocFunctionType = 319,
JSDocVariadicType = 320,
JSDocNamepathType = 321,
JSDoc = 322,
AccessorKeyword = 127,
AsKeyword = 128,
AssertsKeyword = 129,
AssertKeyword = 130,
AnyKeyword = 131,
AsyncKeyword = 132,
AwaitKeyword = 133,
BooleanKeyword = 134,
ConstructorKeyword = 135,
DeclareKeyword = 136,
GetKeyword = 137,
InferKeyword = 138,
IntrinsicKeyword = 139,
IsKeyword = 140,
KeyOfKeyword = 141,
ModuleKeyword = 142,
NamespaceKeyword = 143,
NeverKeyword = 144,
OutKeyword = 145,
ReadonlyKeyword = 146,
RequireKeyword = 147,
NumberKeyword = 148,
ObjectKeyword = 149,
SatisfiesKeyword = 150,
SetKeyword = 151,
StringKeyword = 152,
SymbolKeyword = 153,
TypeKeyword = 154,
UndefinedKeyword = 155,
UniqueKeyword = 156,
UnknownKeyword = 157,
FromKeyword = 158,
GlobalKeyword = 159,
BigIntKeyword = 160,
OverrideKeyword = 161,
OfKeyword = 162,
QualifiedName = 163,
ComputedPropertyName = 164,
TypeParameter = 165,
Parameter = 166,
Decorator = 167,
PropertySignature = 168,
PropertyDeclaration = 169,
MethodSignature = 170,
MethodDeclaration = 171,
ClassStaticBlockDeclaration = 172,
Constructor = 173,
GetAccessor = 174,
SetAccessor = 175,
CallSignature = 176,
ConstructSignature = 177,
IndexSignature = 178,
TypePredicate = 179,
TypeReference = 180,
FunctionType = 181,
ConstructorType = 182,
TypeQuery = 183,
TypeLiteral = 184,
ArrayType = 185,
TupleType = 186,
OptionalType = 187,
RestType = 188,
UnionType = 189,
IntersectionType = 190,
ConditionalType = 191,
InferType = 192,
ParenthesizedType = 193,
ThisType = 194,
TypeOperator = 195,
IndexedAccessType = 196,
MappedType = 197,
LiteralType = 198,
NamedTupleMember = 199,
TemplateLiteralType = 200,
TemplateLiteralTypeSpan = 201,
ImportType = 202,
ObjectBindingPattern = 203,
ArrayBindingPattern = 204,
BindingElement = 205,
ArrayLiteralExpression = 206,
ObjectLiteralExpression = 207,
PropertyAccessExpression = 208,
ElementAccessExpression = 209,
CallExpression = 210,
NewExpression = 211,
TaggedTemplateExpression = 212,
TypeAssertionExpression = 213,
ParenthesizedExpression = 214,
FunctionExpression = 215,
ArrowFunction = 216,
DeleteExpression = 217,
TypeOfExpression = 218,
VoidExpression = 219,
AwaitExpression = 220,
PrefixUnaryExpression = 221,
PostfixUnaryExpression = 222,
BinaryExpression = 223,
ConditionalExpression = 224,
TemplateExpression = 225,
YieldExpression = 226,
SpreadElement = 227,
ClassExpression = 228,
OmittedExpression = 229,
ExpressionWithTypeArguments = 230,
AsExpression = 231,
NonNullExpression = 232,
MetaProperty = 233,
SyntheticExpression = 234,
SatisfiesExpression = 235,
TemplateSpan = 236,
SemicolonClassElement = 237,
Block = 238,
EmptyStatement = 239,
VariableStatement = 240,
ExpressionStatement = 241,
IfStatement = 242,
DoStatement = 243,
WhileStatement = 244,
ForStatement = 245,
ForInStatement = 246,
ForOfStatement = 247,
ContinueStatement = 248,
BreakStatement = 249,
ReturnStatement = 250,
WithStatement = 251,
SwitchStatement = 252,
LabeledStatement = 253,
ThrowStatement = 254,
TryStatement = 255,
DebuggerStatement = 256,
VariableDeclaration = 257,
VariableDeclarationList = 258,
FunctionDeclaration = 259,
ClassDeclaration = 260,
InterfaceDeclaration = 261,
TypeAliasDeclaration = 262,
EnumDeclaration = 263,
ModuleDeclaration = 264,
ModuleBlock = 265,
CaseBlock = 266,
NamespaceExportDeclaration = 267,
ImportEqualsDeclaration = 268,
ImportDeclaration = 269,
ImportClause = 270,
NamespaceImport = 271,
NamedImports = 272,
ImportSpecifier = 273,
ExportAssignment = 274,
ExportDeclaration = 275,
NamedExports = 276,
NamespaceExport = 277,
ExportSpecifier = 278,
MissingDeclaration = 279,
ExternalModuleReference = 280,
JsxElement = 281,
JsxSelfClosingElement = 282,
JsxOpeningElement = 283,
JsxClosingElement = 284,
JsxFragment = 285,
JsxOpeningFragment = 286,
JsxClosingFragment = 287,
JsxAttribute = 288,
JsxAttributes = 289,
JsxSpreadAttribute = 290,
JsxExpression = 291,
CaseClause = 292,
DefaultClause = 293,
HeritageClause = 294,
CatchClause = 295,
AssertClause = 296,
AssertEntry = 297,
ImportTypeAssertionContainer = 298,
PropertyAssignment = 299,
ShorthandPropertyAssignment = 300,
SpreadAssignment = 301,
EnumMember = 302,
UnparsedPrologue = 303,
UnparsedPrepend = 304,
UnparsedText = 305,
UnparsedInternalText = 306,
UnparsedSyntheticReference = 307,
SourceFile = 308,
Bundle = 309,
UnparsedSource = 310,
InputFiles = 311,
JSDocTypeExpression = 312,
JSDocNameReference = 313,
JSDocMemberName = 314,
JSDocAllType = 315,
JSDocUnknownType = 316,
JSDocNullableType = 317,
JSDocNonNullableType = 318,
JSDocOptionalType = 319,
JSDocFunctionType = 320,
JSDocVariadicType = 321,
JSDocNamepathType = 322,
JSDoc = 323,
/** @deprecated Use SyntaxKind.JSDoc */
JSDocComment = 322,
JSDocText = 323,
JSDocTypeLiteral = 324,
JSDocSignature = 325,
JSDocLink = 326,
JSDocLinkCode = 327,
JSDocLinkPlain = 328,
JSDocTag = 329,
JSDocAugmentsTag = 330,
JSDocImplementsTag = 331,
JSDocAuthorTag = 332,
JSDocDeprecatedTag = 333,
JSDocClassTag = 334,
JSDocPublicTag = 335,
JSDocPrivateTag = 336,
JSDocProtectedTag = 337,
JSDocReadonlyTag = 338,
JSDocOverrideTag = 339,
JSDocCallbackTag = 340,
JSDocEnumTag = 341,
JSDocParameterTag = 342,
JSDocReturnTag = 343,
JSDocThisTag = 344,
JSDocTypeTag = 345,
JSDocTemplateTag = 346,
JSDocTypedefTag = 347,
JSDocSeeTag = 348,
JSDocPropertyTag = 349,
SyntaxList = 350,
NotEmittedStatement = 351,
PartiallyEmittedExpression = 352,
CommaListExpression = 353,
MergeDeclarationMarker = 354,
EndOfDeclarationMarker = 355,
SyntheticReferenceExpression = 356,
Count = 357,
JSDocComment = 323,
JSDocText = 324,
JSDocTypeLiteral = 325,
JSDocSignature = 326,
JSDocLink = 327,
JSDocLinkCode = 328,
JSDocLinkPlain = 329,
JSDocTag = 330,
JSDocAugmentsTag = 331,
JSDocImplementsTag = 332,
JSDocAuthorTag = 333,
JSDocDeprecatedTag = 334,
JSDocClassTag = 335,
JSDocPublicTag = 336,
JSDocPrivateTag = 337,
JSDocProtectedTag = 338,
JSDocReadonlyTag = 339,
JSDocOverrideTag = 340,
JSDocCallbackTag = 341,
JSDocEnumTag = 342,
JSDocParameterTag = 343,
JSDocReturnTag = 344,
JSDocThisTag = 345,
JSDocTypeTag = 346,
JSDocTemplateTag = 347,
JSDocTypedefTag = 348,
JSDocSeeTag = 349,
JSDocPropertyTag = 350,
SyntaxList = 351,
NotEmittedStatement = 352,
PartiallyEmittedExpression = 353,
CommaListExpression = 354,
MergeDeclarationMarker = 355,
EndOfDeclarationMarker = 356,
SyntheticReferenceExpression = 357,
Count = 358,
FirstAssignment = 63,
LastAssignment = 78,
FirstCompoundAssignment = 64,
@@ -472,15 +473,15 @@ declare namespace ts {
FirstReservedWord = 81,
LastReservedWord = 116,
FirstKeyword = 81,
LastKeyword = 161,
LastKeyword = 162,
FirstFutureReservedWord = 117,
LastFutureReservedWord = 125,
FirstTypeNode = 178,
LastTypeNode = 201,
FirstTypeNode = 179,
LastTypeNode = 202,
FirstPunctuation = 18,
LastPunctuation = 78,
FirstToken = 0,
LastToken = 161,
LastToken = 162,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -489,20 +490,20 @@ declare namespace ts {
LastTemplateToken = 17,
FirstBinaryOperator = 29,
LastBinaryOperator = 78,
FirstStatement = 239,
LastStatement = 255,
FirstNode = 162,
FirstJSDocNode = 311,
LastJSDocNode = 349,
FirstJSDocTagNode = 329,
LastJSDocTagNode = 349,
FirstStatement = 240,
LastStatement = 256,
FirstNode = 163,
FirstJSDocNode = 312,
LastJSDocNode = 350,
FirstJSDocTagNode = 330,
LastJSDocTagNode = 350,
}
export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail;
export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken;
export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword;
export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword;
export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword;
export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword;
export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword;
export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind;
export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
@@ -547,9 +548,10 @@ declare namespace ts {
Protected = 16,
Static = 32,
Readonly = 64,
Abstract = 128,
Async = 256,
Default = 512,
Accessor = 128,
Abstract = 256,
Async = 512,
Default = 1024,
Const = 2048,
HasComputedJSDocModifiers = 4096,
Deprecated = 8192,
@@ -561,10 +563,10 @@ declare namespace ts {
AccessibilityModifier = 28,
ParameterPropertyModifier = 16476,
NonPublicAccessibilityModifier = 24,
TypeScriptModifier = 116958,
ExportDefault = 513,
All = 257023,
Modifier = 125951
TypeScriptModifier = 117086,
ExportDefault = 1025,
All = 258047,
Modifier = 126975
}
export enum JsxFlags {
None = 0,
@@ -620,6 +622,7 @@ declare namespace ts {
export interface ModifierToken<TKind extends ModifierSyntaxKind> extends KeywordToken<TKind> {
}
export type AbstractKeyword = ModifierToken<SyntaxKind.AbstractKeyword>;
export type AccessorKeyword = ModifierToken<SyntaxKind.AccessorKeyword>;
export type AsyncKeyword = ModifierToken<SyntaxKind.AsyncKeyword>;
export type ConstKeyword = ModifierToken<SyntaxKind.ConstKeyword>;
export type DeclareKeyword = ModifierToken<SyntaxKind.DeclareKeyword>;
@@ -635,11 +638,11 @@ declare namespace ts {
export type StaticKeyword = ModifierToken<SyntaxKind.StaticKeyword>;
/** @deprecated Use `ReadonlyKeyword` instead. */
export type ReadonlyToken = ReadonlyKeyword;
export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword;
export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword;
export type ModifierLike = Modifier | Decorator;
export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword;
export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword;
export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword;
export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword;
export type ModifiersArray = NodeArray<Modifier>;
export enum GeneratedIdentifierFlags {
None = 0,
@@ -766,6 +769,9 @@ declare namespace ts {
readonly type?: TypeNode;
readonly initializer?: Expression;
}
export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration {
_autoAccessorBrand: any;
}
export interface ObjectLiteralElement extends NamedDeclaration {
_objectLiteralBrand: any;
readonly name?: PropertyName;
@@ -2570,6 +2576,7 @@ declare namespace ts {
MethodExcludes = 103359,
GetAccessorExcludes = 46015,
SetAccessorExcludes = 78783,
AccessorExcludes = 13247,
TypeParameterExcludes = 526824,
TypeAliasExcludes = 788968,
AliasExcludes = 2097152,
@@ -3395,7 +3402,7 @@ declare namespace ts {
createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral;
createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral;
createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral;
createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral;
createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral;
createRegularExpressionLiteral(text: string): RegularExpressionLiteral;
createIdentifier(text: string): Identifier;
/**
@@ -3420,6 +3427,8 @@ declare namespace ts {
/** Create a unique name generated for a node. */
getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier;
createPrivateIdentifier(text: string): PrivateIdentifier;
createUniquePrivateName(text?: string): PrivateIdentifier;
getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier;
createToken(token: SyntaxKind.SuperKeyword): SuperExpression;
createToken(token: SyntaxKind.ThisKeyword): ThisExpression;
createToken(token: SyntaxKind.NullKeyword): NullLiteral;
@@ -3958,7 +3967,7 @@ declare namespace ts {
<T extends Node>(nodes: NodeArray<T>, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>;
<T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined;
}
export type VisitResult<T extends Node> = T | T[] | undefined;
export type VisitResult<T extends Node> = T | readonly T[] | undefined;
export interface Printer {
/**
* Print a node and its subtree as-is, without any emit transformations.
@@ -4525,6 +4534,7 @@ declare namespace ts {
function isClassElement(node: Node): node is ClassElement;
function isClassLike(node: Node): node is ClassLikeDeclaration;
function isAccessor(node: Node): node is AccessorDeclaration;
function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration;
function isModifierLike(node: Node): node is ModifierLike;
function isTypeElement(node: Node): node is TypeElement;
function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
@@ -6750,6 +6760,8 @@ declare namespace ts {
* interface Y { foo:number; }
*/
memberVariableElement = "property",
/** class X { [public|private]* accessor foo: number; } */
memberAccessorVariableElement = "accessor",
/**
* class X { constructor() { } }
* class X { static { } }
@@ -10896,7 +10908,7 @@ declare namespace ts {
(text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral;
};
/** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */
const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral;
const createStringLiteralFromNode: (sourceNode: PrivateIdentifier | PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral;
/** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */
const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral;
/** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */
+269 -257
View File
@@ -232,239 +232,240 @@ declare namespace ts {
StaticKeyword = 124,
YieldKeyword = 125,
AbstractKeyword = 126,
AsKeyword = 127,
AssertsKeyword = 128,
AssertKeyword = 129,
AnyKeyword = 130,
AsyncKeyword = 131,
AwaitKeyword = 132,
BooleanKeyword = 133,
ConstructorKeyword = 134,
DeclareKeyword = 135,
GetKeyword = 136,
InferKeyword = 137,
IntrinsicKeyword = 138,
IsKeyword = 139,
KeyOfKeyword = 140,
ModuleKeyword = 141,
NamespaceKeyword = 142,
NeverKeyword = 143,
OutKeyword = 144,
ReadonlyKeyword = 145,
RequireKeyword = 146,
NumberKeyword = 147,
ObjectKeyword = 148,
SatisfiesKeyword = 149,
SetKeyword = 150,
StringKeyword = 151,
SymbolKeyword = 152,
TypeKeyword = 153,
UndefinedKeyword = 154,
UniqueKeyword = 155,
UnknownKeyword = 156,
FromKeyword = 157,
GlobalKeyword = 158,
BigIntKeyword = 159,
OverrideKeyword = 160,
OfKeyword = 161,
QualifiedName = 162,
ComputedPropertyName = 163,
TypeParameter = 164,
Parameter = 165,
Decorator = 166,
PropertySignature = 167,
PropertyDeclaration = 168,
MethodSignature = 169,
MethodDeclaration = 170,
ClassStaticBlockDeclaration = 171,
Constructor = 172,
GetAccessor = 173,
SetAccessor = 174,
CallSignature = 175,
ConstructSignature = 176,
IndexSignature = 177,
TypePredicate = 178,
TypeReference = 179,
FunctionType = 180,
ConstructorType = 181,
TypeQuery = 182,
TypeLiteral = 183,
ArrayType = 184,
TupleType = 185,
OptionalType = 186,
RestType = 187,
UnionType = 188,
IntersectionType = 189,
ConditionalType = 190,
InferType = 191,
ParenthesizedType = 192,
ThisType = 193,
TypeOperator = 194,
IndexedAccessType = 195,
MappedType = 196,
LiteralType = 197,
NamedTupleMember = 198,
TemplateLiteralType = 199,
TemplateLiteralTypeSpan = 200,
ImportType = 201,
ObjectBindingPattern = 202,
ArrayBindingPattern = 203,
BindingElement = 204,
ArrayLiteralExpression = 205,
ObjectLiteralExpression = 206,
PropertyAccessExpression = 207,
ElementAccessExpression = 208,
CallExpression = 209,
NewExpression = 210,
TaggedTemplateExpression = 211,
TypeAssertionExpression = 212,
ParenthesizedExpression = 213,
FunctionExpression = 214,
ArrowFunction = 215,
DeleteExpression = 216,
TypeOfExpression = 217,
VoidExpression = 218,
AwaitExpression = 219,
PrefixUnaryExpression = 220,
PostfixUnaryExpression = 221,
BinaryExpression = 222,
ConditionalExpression = 223,
TemplateExpression = 224,
YieldExpression = 225,
SpreadElement = 226,
ClassExpression = 227,
OmittedExpression = 228,
ExpressionWithTypeArguments = 229,
AsExpression = 230,
NonNullExpression = 231,
MetaProperty = 232,
SyntheticExpression = 233,
SatisfiesExpression = 234,
TemplateSpan = 235,
SemicolonClassElement = 236,
Block = 237,
EmptyStatement = 238,
VariableStatement = 239,
ExpressionStatement = 240,
IfStatement = 241,
DoStatement = 242,
WhileStatement = 243,
ForStatement = 244,
ForInStatement = 245,
ForOfStatement = 246,
ContinueStatement = 247,
BreakStatement = 248,
ReturnStatement = 249,
WithStatement = 250,
SwitchStatement = 251,
LabeledStatement = 252,
ThrowStatement = 253,
TryStatement = 254,
DebuggerStatement = 255,
VariableDeclaration = 256,
VariableDeclarationList = 257,
FunctionDeclaration = 258,
ClassDeclaration = 259,
InterfaceDeclaration = 260,
TypeAliasDeclaration = 261,
EnumDeclaration = 262,
ModuleDeclaration = 263,
ModuleBlock = 264,
CaseBlock = 265,
NamespaceExportDeclaration = 266,
ImportEqualsDeclaration = 267,
ImportDeclaration = 268,
ImportClause = 269,
NamespaceImport = 270,
NamedImports = 271,
ImportSpecifier = 272,
ExportAssignment = 273,
ExportDeclaration = 274,
NamedExports = 275,
NamespaceExport = 276,
ExportSpecifier = 277,
MissingDeclaration = 278,
ExternalModuleReference = 279,
JsxElement = 280,
JsxSelfClosingElement = 281,
JsxOpeningElement = 282,
JsxClosingElement = 283,
JsxFragment = 284,
JsxOpeningFragment = 285,
JsxClosingFragment = 286,
JsxAttribute = 287,
JsxAttributes = 288,
JsxSpreadAttribute = 289,
JsxExpression = 290,
CaseClause = 291,
DefaultClause = 292,
HeritageClause = 293,
CatchClause = 294,
AssertClause = 295,
AssertEntry = 296,
ImportTypeAssertionContainer = 297,
PropertyAssignment = 298,
ShorthandPropertyAssignment = 299,
SpreadAssignment = 300,
EnumMember = 301,
UnparsedPrologue = 302,
UnparsedPrepend = 303,
UnparsedText = 304,
UnparsedInternalText = 305,
UnparsedSyntheticReference = 306,
SourceFile = 307,
Bundle = 308,
UnparsedSource = 309,
InputFiles = 310,
JSDocTypeExpression = 311,
JSDocNameReference = 312,
JSDocMemberName = 313,
JSDocAllType = 314,
JSDocUnknownType = 315,
JSDocNullableType = 316,
JSDocNonNullableType = 317,
JSDocOptionalType = 318,
JSDocFunctionType = 319,
JSDocVariadicType = 320,
JSDocNamepathType = 321,
JSDoc = 322,
AccessorKeyword = 127,
AsKeyword = 128,
AssertsKeyword = 129,
AssertKeyword = 130,
AnyKeyword = 131,
AsyncKeyword = 132,
AwaitKeyword = 133,
BooleanKeyword = 134,
ConstructorKeyword = 135,
DeclareKeyword = 136,
GetKeyword = 137,
InferKeyword = 138,
IntrinsicKeyword = 139,
IsKeyword = 140,
KeyOfKeyword = 141,
ModuleKeyword = 142,
NamespaceKeyword = 143,
NeverKeyword = 144,
OutKeyword = 145,
ReadonlyKeyword = 146,
RequireKeyword = 147,
NumberKeyword = 148,
ObjectKeyword = 149,
SatisfiesKeyword = 150,
SetKeyword = 151,
StringKeyword = 152,
SymbolKeyword = 153,
TypeKeyword = 154,
UndefinedKeyword = 155,
UniqueKeyword = 156,
UnknownKeyword = 157,
FromKeyword = 158,
GlobalKeyword = 159,
BigIntKeyword = 160,
OverrideKeyword = 161,
OfKeyword = 162,
QualifiedName = 163,
ComputedPropertyName = 164,
TypeParameter = 165,
Parameter = 166,
Decorator = 167,
PropertySignature = 168,
PropertyDeclaration = 169,
MethodSignature = 170,
MethodDeclaration = 171,
ClassStaticBlockDeclaration = 172,
Constructor = 173,
GetAccessor = 174,
SetAccessor = 175,
CallSignature = 176,
ConstructSignature = 177,
IndexSignature = 178,
TypePredicate = 179,
TypeReference = 180,
FunctionType = 181,
ConstructorType = 182,
TypeQuery = 183,
TypeLiteral = 184,
ArrayType = 185,
TupleType = 186,
OptionalType = 187,
RestType = 188,
UnionType = 189,
IntersectionType = 190,
ConditionalType = 191,
InferType = 192,
ParenthesizedType = 193,
ThisType = 194,
TypeOperator = 195,
IndexedAccessType = 196,
MappedType = 197,
LiteralType = 198,
NamedTupleMember = 199,
TemplateLiteralType = 200,
TemplateLiteralTypeSpan = 201,
ImportType = 202,
ObjectBindingPattern = 203,
ArrayBindingPattern = 204,
BindingElement = 205,
ArrayLiteralExpression = 206,
ObjectLiteralExpression = 207,
PropertyAccessExpression = 208,
ElementAccessExpression = 209,
CallExpression = 210,
NewExpression = 211,
TaggedTemplateExpression = 212,
TypeAssertionExpression = 213,
ParenthesizedExpression = 214,
FunctionExpression = 215,
ArrowFunction = 216,
DeleteExpression = 217,
TypeOfExpression = 218,
VoidExpression = 219,
AwaitExpression = 220,
PrefixUnaryExpression = 221,
PostfixUnaryExpression = 222,
BinaryExpression = 223,
ConditionalExpression = 224,
TemplateExpression = 225,
YieldExpression = 226,
SpreadElement = 227,
ClassExpression = 228,
OmittedExpression = 229,
ExpressionWithTypeArguments = 230,
AsExpression = 231,
NonNullExpression = 232,
MetaProperty = 233,
SyntheticExpression = 234,
SatisfiesExpression = 235,
TemplateSpan = 236,
SemicolonClassElement = 237,
Block = 238,
EmptyStatement = 239,
VariableStatement = 240,
ExpressionStatement = 241,
IfStatement = 242,
DoStatement = 243,
WhileStatement = 244,
ForStatement = 245,
ForInStatement = 246,
ForOfStatement = 247,
ContinueStatement = 248,
BreakStatement = 249,
ReturnStatement = 250,
WithStatement = 251,
SwitchStatement = 252,
LabeledStatement = 253,
ThrowStatement = 254,
TryStatement = 255,
DebuggerStatement = 256,
VariableDeclaration = 257,
VariableDeclarationList = 258,
FunctionDeclaration = 259,
ClassDeclaration = 260,
InterfaceDeclaration = 261,
TypeAliasDeclaration = 262,
EnumDeclaration = 263,
ModuleDeclaration = 264,
ModuleBlock = 265,
CaseBlock = 266,
NamespaceExportDeclaration = 267,
ImportEqualsDeclaration = 268,
ImportDeclaration = 269,
ImportClause = 270,
NamespaceImport = 271,
NamedImports = 272,
ImportSpecifier = 273,
ExportAssignment = 274,
ExportDeclaration = 275,
NamedExports = 276,
NamespaceExport = 277,
ExportSpecifier = 278,
MissingDeclaration = 279,
ExternalModuleReference = 280,
JsxElement = 281,
JsxSelfClosingElement = 282,
JsxOpeningElement = 283,
JsxClosingElement = 284,
JsxFragment = 285,
JsxOpeningFragment = 286,
JsxClosingFragment = 287,
JsxAttribute = 288,
JsxAttributes = 289,
JsxSpreadAttribute = 290,
JsxExpression = 291,
CaseClause = 292,
DefaultClause = 293,
HeritageClause = 294,
CatchClause = 295,
AssertClause = 296,
AssertEntry = 297,
ImportTypeAssertionContainer = 298,
PropertyAssignment = 299,
ShorthandPropertyAssignment = 300,
SpreadAssignment = 301,
EnumMember = 302,
UnparsedPrologue = 303,
UnparsedPrepend = 304,
UnparsedText = 305,
UnparsedInternalText = 306,
UnparsedSyntheticReference = 307,
SourceFile = 308,
Bundle = 309,
UnparsedSource = 310,
InputFiles = 311,
JSDocTypeExpression = 312,
JSDocNameReference = 313,
JSDocMemberName = 314,
JSDocAllType = 315,
JSDocUnknownType = 316,
JSDocNullableType = 317,
JSDocNonNullableType = 318,
JSDocOptionalType = 319,
JSDocFunctionType = 320,
JSDocVariadicType = 321,
JSDocNamepathType = 322,
JSDoc = 323,
/** @deprecated Use SyntaxKind.JSDoc */
JSDocComment = 322,
JSDocText = 323,
JSDocTypeLiteral = 324,
JSDocSignature = 325,
JSDocLink = 326,
JSDocLinkCode = 327,
JSDocLinkPlain = 328,
JSDocTag = 329,
JSDocAugmentsTag = 330,
JSDocImplementsTag = 331,
JSDocAuthorTag = 332,
JSDocDeprecatedTag = 333,
JSDocClassTag = 334,
JSDocPublicTag = 335,
JSDocPrivateTag = 336,
JSDocProtectedTag = 337,
JSDocReadonlyTag = 338,
JSDocOverrideTag = 339,
JSDocCallbackTag = 340,
JSDocEnumTag = 341,
JSDocParameterTag = 342,
JSDocReturnTag = 343,
JSDocThisTag = 344,
JSDocTypeTag = 345,
JSDocTemplateTag = 346,
JSDocTypedefTag = 347,
JSDocSeeTag = 348,
JSDocPropertyTag = 349,
SyntaxList = 350,
NotEmittedStatement = 351,
PartiallyEmittedExpression = 352,
CommaListExpression = 353,
MergeDeclarationMarker = 354,
EndOfDeclarationMarker = 355,
SyntheticReferenceExpression = 356,
Count = 357,
JSDocComment = 323,
JSDocText = 324,
JSDocTypeLiteral = 325,
JSDocSignature = 326,
JSDocLink = 327,
JSDocLinkCode = 328,
JSDocLinkPlain = 329,
JSDocTag = 330,
JSDocAugmentsTag = 331,
JSDocImplementsTag = 332,
JSDocAuthorTag = 333,
JSDocDeprecatedTag = 334,
JSDocClassTag = 335,
JSDocPublicTag = 336,
JSDocPrivateTag = 337,
JSDocProtectedTag = 338,
JSDocReadonlyTag = 339,
JSDocOverrideTag = 340,
JSDocCallbackTag = 341,
JSDocEnumTag = 342,
JSDocParameterTag = 343,
JSDocReturnTag = 344,
JSDocThisTag = 345,
JSDocTypeTag = 346,
JSDocTemplateTag = 347,
JSDocTypedefTag = 348,
JSDocSeeTag = 349,
JSDocPropertyTag = 350,
SyntaxList = 351,
NotEmittedStatement = 352,
PartiallyEmittedExpression = 353,
CommaListExpression = 354,
MergeDeclarationMarker = 355,
EndOfDeclarationMarker = 356,
SyntheticReferenceExpression = 357,
Count = 358,
FirstAssignment = 63,
LastAssignment = 78,
FirstCompoundAssignment = 64,
@@ -472,15 +473,15 @@ declare namespace ts {
FirstReservedWord = 81,
LastReservedWord = 116,
FirstKeyword = 81,
LastKeyword = 161,
LastKeyword = 162,
FirstFutureReservedWord = 117,
LastFutureReservedWord = 125,
FirstTypeNode = 178,
LastTypeNode = 201,
FirstTypeNode = 179,
LastTypeNode = 202,
FirstPunctuation = 18,
LastPunctuation = 78,
FirstToken = 0,
LastToken = 161,
LastToken = 162,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -489,20 +490,20 @@ declare namespace ts {
LastTemplateToken = 17,
FirstBinaryOperator = 29,
LastBinaryOperator = 78,
FirstStatement = 239,
LastStatement = 255,
FirstNode = 162,
FirstJSDocNode = 311,
LastJSDocNode = 349,
FirstJSDocTagNode = 329,
LastJSDocTagNode = 349,
FirstStatement = 240,
LastStatement = 256,
FirstNode = 163,
FirstJSDocNode = 312,
LastJSDocNode = 350,
FirstJSDocTagNode = 330,
LastJSDocTagNode = 350,
}
export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail;
export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken;
export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword;
export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword;
export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword;
export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword;
export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword;
export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind;
export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
@@ -547,9 +548,10 @@ declare namespace ts {
Protected = 16,
Static = 32,
Readonly = 64,
Abstract = 128,
Async = 256,
Default = 512,
Accessor = 128,
Abstract = 256,
Async = 512,
Default = 1024,
Const = 2048,
HasComputedJSDocModifiers = 4096,
Deprecated = 8192,
@@ -561,10 +563,10 @@ declare namespace ts {
AccessibilityModifier = 28,
ParameterPropertyModifier = 16476,
NonPublicAccessibilityModifier = 24,
TypeScriptModifier = 116958,
ExportDefault = 513,
All = 257023,
Modifier = 125951
TypeScriptModifier = 117086,
ExportDefault = 1025,
All = 258047,
Modifier = 126975
}
export enum JsxFlags {
None = 0,
@@ -620,6 +622,7 @@ declare namespace ts {
export interface ModifierToken<TKind extends ModifierSyntaxKind> extends KeywordToken<TKind> {
}
export type AbstractKeyword = ModifierToken<SyntaxKind.AbstractKeyword>;
export type AccessorKeyword = ModifierToken<SyntaxKind.AccessorKeyword>;
export type AsyncKeyword = ModifierToken<SyntaxKind.AsyncKeyword>;
export type ConstKeyword = ModifierToken<SyntaxKind.ConstKeyword>;
export type DeclareKeyword = ModifierToken<SyntaxKind.DeclareKeyword>;
@@ -635,11 +638,11 @@ declare namespace ts {
export type StaticKeyword = ModifierToken<SyntaxKind.StaticKeyword>;
/** @deprecated Use `ReadonlyKeyword` instead. */
export type ReadonlyToken = ReadonlyKeyword;
export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword;
export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword;
export type ModifierLike = Modifier | Decorator;
export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword;
export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword;
export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword;
export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword;
export type ModifiersArray = NodeArray<Modifier>;
export enum GeneratedIdentifierFlags {
None = 0,
@@ -766,6 +769,9 @@ declare namespace ts {
readonly type?: TypeNode;
readonly initializer?: Expression;
}
export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration {
_autoAccessorBrand: any;
}
export interface ObjectLiteralElement extends NamedDeclaration {
_objectLiteralBrand: any;
readonly name?: PropertyName;
@@ -2570,6 +2576,7 @@ declare namespace ts {
MethodExcludes = 103359,
GetAccessorExcludes = 46015,
SetAccessorExcludes = 78783,
AccessorExcludes = 13247,
TypeParameterExcludes = 526824,
TypeAliasExcludes = 788968,
AliasExcludes = 2097152,
@@ -3395,7 +3402,7 @@ declare namespace ts {
createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral;
createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral;
createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral;
createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral;
createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral;
createRegularExpressionLiteral(text: string): RegularExpressionLiteral;
createIdentifier(text: string): Identifier;
/**
@@ -3420,6 +3427,8 @@ declare namespace ts {
/** Create a unique name generated for a node. */
getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier;
createPrivateIdentifier(text: string): PrivateIdentifier;
createUniquePrivateName(text?: string): PrivateIdentifier;
getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier;
createToken(token: SyntaxKind.SuperKeyword): SuperExpression;
createToken(token: SyntaxKind.ThisKeyword): ThisExpression;
createToken(token: SyntaxKind.NullKeyword): NullLiteral;
@@ -3958,7 +3967,7 @@ declare namespace ts {
<T extends Node>(nodes: NodeArray<T>, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>;
<T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined;
}
export type VisitResult<T extends Node> = T | T[] | undefined;
export type VisitResult<T extends Node> = T | readonly T[] | undefined;
export interface Printer {
/**
* Print a node and its subtree as-is, without any emit transformations.
@@ -4525,6 +4534,7 @@ declare namespace ts {
function isClassElement(node: Node): node is ClassElement;
function isClassLike(node: Node): node is ClassLikeDeclaration;
function isAccessor(node: Node): node is AccessorDeclaration;
function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration;
function isModifierLike(node: Node): node is ModifierLike;
function isTypeElement(node: Node): node is TypeElement;
function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement;
@@ -6750,6 +6760,8 @@ declare namespace ts {
* interface Y { foo:number; }
*/
memberVariableElement = "property",
/** class X { [public|private]* accessor foo: number; } */
memberAccessorVariableElement = "accessor",
/**
* class X { constructor() { } }
* class X { static { } }
@@ -7029,7 +7041,7 @@ declare namespace ts {
(text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral;
};
/** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */
const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral;
const createStringLiteralFromNode: (sourceNode: PrivateIdentifier | PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral;
/** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */
const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral;
/** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */
@@ -0,0 +1,39 @@
//// [autoAccessor1.ts]
class C1 {
accessor a: any;
accessor b = 1;
static accessor c: any;
static accessor d = 2;
}
//// [autoAccessor1.js]
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _a, _C1_a_accessor_storage, _C1_b_accessor_storage, _C1_c_accessor_storage, _C1_d_accessor_storage;
class C1 {
constructor() {
_C1_a_accessor_storage.set(this, void 0);
_C1_b_accessor_storage.set(this, 1);
}
get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); }
set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); }
get b() { return __classPrivateFieldGet(this, _C1_b_accessor_storage, "f"); }
set b(value) { __classPrivateFieldSet(this, _C1_b_accessor_storage, value, "f"); }
static get c() { return __classPrivateFieldGet(this, _a, "f", _C1_c_accessor_storage); }
static set c(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_c_accessor_storage); }
static get d() { return __classPrivateFieldGet(this, _a, "f", _C1_d_accessor_storage); }
static set d(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_d_accessor_storage); }
}
_a = C1, _C1_a_accessor_storage = new WeakMap(), _C1_b_accessor_storage = new WeakMap();
_C1_c_accessor_storage = { value: void 0 };
_C1_d_accessor_storage = { value: 2 };
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor1.ts, 0, 0))
accessor a: any;
>a : Symbol(C1.a, Decl(autoAccessor1.ts, 0, 10))
accessor b = 1;
>b : Symbol(C1.b, Decl(autoAccessor1.ts, 1, 20))
static accessor c: any;
>c : Symbol(C1.c, Decl(autoAccessor1.ts, 2, 19))
static accessor d = 2;
>d : Symbol(C1.d, Decl(autoAccessor1.ts, 3, 27))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts ===
class C1 {
>C1 : C1
accessor a: any;
>a : any
accessor b = 1;
>b : number
>1 : 1
static accessor c: any;
>c : any
static accessor d = 2;
>d : number
>2 : 2
}
@@ -0,0 +1,24 @@
//// [autoAccessor1.ts]
class C1 {
accessor a: any;
accessor b = 1;
static accessor c: any;
static accessor d = 2;
}
//// [autoAccessor1.js]
class C1 {
#a_accessor_storage;
get a() { return this.#a_accessor_storage; }
set a(value) { this.#a_accessor_storage = value; }
#b_accessor_storage = 1;
get b() { return this.#b_accessor_storage; }
set b(value) { this.#b_accessor_storage = value; }
static #c_accessor_storage;
static get c() { return this.#c_accessor_storage; }
static set c(value) { this.#c_accessor_storage = value; }
static #d_accessor_storage = 2;
static get d() { return this.#d_accessor_storage; }
static set d(value) { this.#d_accessor_storage = value; }
}
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor1.ts, 0, 0))
accessor a: any;
>a : Symbol(C1.a, Decl(autoAccessor1.ts, 0, 10))
accessor b = 1;
>b : Symbol(C1.b, Decl(autoAccessor1.ts, 1, 20))
static accessor c: any;
>c : Symbol(C1.c, Decl(autoAccessor1.ts, 2, 19))
static accessor d = 2;
>d : Symbol(C1.d, Decl(autoAccessor1.ts, 3, 27))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts ===
class C1 {
>C1 : C1
accessor a: any;
>a : any
accessor b = 1;
>b : number
>1 : 1
static accessor c: any;
>c : any
static accessor d = 2;
>d : number
>2 : 2
}
@@ -0,0 +1,22 @@
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts (4 errors) ====
class C1 {
accessor a: any;
~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
accessor b = 1;
~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
static accessor c: any;
~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
static accessor d = 2;
~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
}
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor1.ts, 0, 0))
accessor a: any;
>a : Symbol(C1.a, Decl(autoAccessor1.ts, 0, 10))
accessor b = 1;
>b : Symbol(C1.b, Decl(autoAccessor1.ts, 1, 20))
static accessor c: any;
>c : Symbol(C1.c, Decl(autoAccessor1.ts, 2, 19))
static accessor d = 2;
>d : Symbol(C1.d, Decl(autoAccessor1.ts, 3, 27))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts ===
class C1 {
>C1 : C1
accessor a: any;
>a : any
accessor b = 1;
>b : number
>1 : 1
static accessor c: any;
>c : any
static accessor d = 2;
>d : number
>2 : 2
}
@@ -0,0 +1,16 @@
//// [autoAccessor1.ts]
class C1 {
accessor a: any;
accessor b = 1;
static accessor c: any;
static accessor d = 2;
}
//// [autoAccessor1.js]
class C1 {
accessor a;
accessor b = 1;
static accessor c;
static accessor d = 2;
}
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor1.ts, 0, 0))
accessor a: any;
>a : Symbol(C1.a, Decl(autoAccessor1.ts, 0, 10))
accessor b = 1;
>b : Symbol(C1.b, Decl(autoAccessor1.ts, 1, 20))
static accessor c: any;
>c : Symbol(C1.c, Decl(autoAccessor1.ts, 2, 19))
static accessor d = 2;
>d : Symbol(C1.d, Decl(autoAccessor1.ts, 3, 27))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor1.ts ===
class C1 {
>C1 : C1
accessor a: any;
>a : any
accessor b = 1;
>b : number
>1 : 1
static accessor c: any;
>c : any
static accessor d = 2;
>d : number
>2 : 2
}
@@ -0,0 +1,48 @@
//// [autoAccessor2.ts]
class C1 {
accessor #a: any;
accessor #b = 1;
static accessor #c: any;
static accessor #d = 2;
constructor() {
this.#a = 3;
this.#b = 4;
}
static {
this.#c = 5;
this.#d = 6;
}
}
//// [autoAccessor2.js]
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _C1_instances, _a, _C1_a_get, _C1_a_set, _C1_b_get, _C1_b_set, _C1_c_get, _C1_c_set, _C1_d_get, _C1_d_set, _C1_a_accessor_storage, _C1_b_accessor_storage, _C1_c_accessor_storage, _C1_d_accessor_storage;
class C1 {
constructor() {
_C1_instances.add(this);
_C1_a_accessor_storage.set(this, void 0);
_C1_b_accessor_storage.set(this, 1);
__classPrivateFieldSet(this, _C1_instances, 3, "a", _C1_a_set);
__classPrivateFieldSet(this, _C1_instances, 4, "a", _C1_b_set);
}
}
_a = C1, _C1_instances = new WeakSet(), _C1_a_accessor_storage = new WeakMap(), _C1_b_accessor_storage = new WeakMap(), _C1_a_get = function _C1_a_get() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); }, _C1_a_set = function _C1_a_set(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); }, _C1_b_get = function _C1_b_get() { return __classPrivateFieldGet(this, _C1_b_accessor_storage, "f"); }, _C1_b_set = function _C1_b_set(value) { __classPrivateFieldSet(this, _C1_b_accessor_storage, value, "f"); }, _C1_c_get = function _C1_c_get() { return __classPrivateFieldGet(this, _a, "f", _C1_c_accessor_storage); }, _C1_c_set = function _C1_c_set(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_c_accessor_storage); }, _C1_d_get = function _C1_d_get() { return __classPrivateFieldGet(this, _a, "f", _C1_d_accessor_storage); }, _C1_d_set = function _C1_d_set(value) { __classPrivateFieldSet(this, _a, value, "f", _C1_d_accessor_storage); };
_C1_c_accessor_storage = { value: void 0 };
_C1_d_accessor_storage = { value: 2 };
(() => {
__classPrivateFieldSet(_a, _a, 5, "a", _C1_c_set);
__classPrivateFieldSet(_a, _a, 6, "a", _C1_d_set);
})();
@@ -0,0 +1,37 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
accessor #a: any;
>#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10))
accessor #b = 1;
>#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21))
static accessor #c: any;
>#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20))
static accessor #d = 2;
>#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28))
constructor() {
this.#a = 3;
>this.#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
this.#b = 4;
>this.#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
}
static {
this.#c = 5;
>this.#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
this.#d = 6;
>this.#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
}
}
@@ -0,0 +1,47 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts ===
class C1 {
>C1 : C1
accessor #a: any;
>#a : any
accessor #b = 1;
>#b : number
>1 : 1
static accessor #c: any;
>#c : any
static accessor #d = 2;
>#d : number
>2 : 2
constructor() {
this.#a = 3;
>this.#a = 3 : 3
>this.#a : any
>this : this
>3 : 3
this.#b = 4;
>this.#b = 4 : 4
>this.#b : number
>this : this
>4 : 4
}
static {
this.#c = 5;
>this.#c = 5 : 5
>this.#c : any
>this : typeof C1
>5 : 5
this.#d = 6;
>this.#d = 6 : 6
>this.#d : number
>this : typeof C1
>6 : 6
}
}
@@ -0,0 +1,42 @@
//// [autoAccessor2.ts]
class C1 {
accessor #a: any;
accessor #b = 1;
static accessor #c: any;
static accessor #d = 2;
constructor() {
this.#a = 3;
this.#b = 4;
}
static {
this.#c = 5;
this.#d = 6;
}
}
//// [autoAccessor2.js]
class C1 {
#a_accessor_storage;
get #a() { return this.#a_accessor_storage; }
set #a(value) { this.#a_accessor_storage = value; }
#b_accessor_storage = 1;
get #b() { return this.#b_accessor_storage; }
set #b(value) { this.#b_accessor_storage = value; }
static #c_accessor_storage;
static get #c() { return this.#c_accessor_storage; }
static set #c(value) { this.#c_accessor_storage = value; }
static #d_accessor_storage = 2;
static get #d() { return this.#d_accessor_storage; }
static set #d(value) { this.#d_accessor_storage = value; }
constructor() {
this.#a = 3;
this.#b = 4;
}
static {
this.#c = 5;
this.#d = 6;
}
}
@@ -0,0 +1,37 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
accessor #a: any;
>#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10))
accessor #b = 1;
>#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21))
static accessor #c: any;
>#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20))
static accessor #d = 2;
>#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28))
constructor() {
this.#a = 3;
>this.#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
this.#b = 4;
>this.#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
}
static {
this.#c = 5;
>this.#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
this.#d = 6;
>this.#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
}
}
@@ -0,0 +1,47 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts ===
class C1 {
>C1 : C1
accessor #a: any;
>#a : any
accessor #b = 1;
>#b : number
>1 : 1
static accessor #c: any;
>#c : any
static accessor #d = 2;
>#d : number
>2 : 2
constructor() {
this.#a = 3;
>this.#a = 3 : 3
>this.#a : any
>this : this
>3 : 3
this.#b = 4;
>this.#b = 4 : 4
>this.#b : number
>this : this
>4 : 4
}
static {
this.#c = 5;
>this.#c = 5 : 5
>this.#c : any
>this : typeof C1
>5 : 5
this.#d = 6;
>this.#d = 6 : 6
>this.#d : number
>this : typeof C1
>6 : 6
}
}
@@ -0,0 +1,34 @@
//// [autoAccessor2.ts]
class C1 {
accessor #a: any;
accessor #b = 1;
static accessor #c: any;
static accessor #d = 2;
constructor() {
this.#a = 3;
this.#b = 4;
}
static {
this.#c = 5;
this.#d = 6;
}
}
//// [autoAccessor2.js]
class C1 {
accessor #a;
accessor #b = 1;
static accessor #c;
static accessor #d = 2;
constructor() {
this.#a = 3;
this.#b = 4;
}
static {
this.#c = 5;
this.#d = 6;
}
}
@@ -0,0 +1,37 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
accessor #a: any;
>#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10))
accessor #b = 1;
>#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21))
static accessor #c: any;
>#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20))
static accessor #d = 2;
>#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28))
constructor() {
this.#a = 3;
>this.#a : Symbol(C1.#a, Decl(autoAccessor2.ts, 0, 10))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
this.#b = 4;
>this.#b : Symbol(C1.#b, Decl(autoAccessor2.ts, 1, 21))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
}
static {
this.#c = 5;
>this.#c : Symbol(C1.#c, Decl(autoAccessor2.ts, 2, 20))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
this.#d = 6;
>this.#d : Symbol(C1.#d, Decl(autoAccessor2.ts, 3, 28))
>this : Symbol(C1, Decl(autoAccessor2.ts, 0, 0))
}
}
@@ -0,0 +1,47 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor2.ts ===
class C1 {
>C1 : C1
accessor #a: any;
>#a : any
accessor #b = 1;
>#b : number
>1 : 1
static accessor #c: any;
>#c : any
static accessor #d = 2;
>#d : number
>2 : 2
constructor() {
this.#a = 3;
>this.#a = 3 : 3
>this.#a : any
>this : this
>3 : 3
this.#b = 4;
>this.#b = 4 : 4
>this.#b : number
>this : this
>4 : 4
}
static {
this.#c = 5;
>this.#c = 5 : 5
>this.#c : any
>this : typeof C1
>5 : 5
this.#d = 6;
>this.#d = 6 : 6
>this.#d : number
>this : typeof C1
>6 : 6
}
}
@@ -0,0 +1,39 @@
//// [autoAccessor3.ts]
class C1 {
accessor "w": any;
accessor "x" = 1;
static accessor "y": any;
static accessor "z" = 2;
}
//// [autoAccessor3.js]
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage;
class C1 {
constructor() {
_C1__a_accessor_storage.set(this, void 0);
_C1__b_accessor_storage.set(this, 1);
}
get "w"() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); }
set "w"(value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); }
get "x"() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); }
set "x"(value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); }
static get "y"() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); }
static set "y"(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); }
static get "z"() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); }
static set "z"(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); }
}
_a = C1, _C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap();
_C1__c_accessor_storage = { value: void 0 };
_C1__d_accessor_storage = { value: 2 };
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor3.ts, 0, 0))
accessor "w": any;
>"w" : Symbol(C1["w"], Decl(autoAccessor3.ts, 0, 10))
accessor "x" = 1;
>"x" : Symbol(C1["x"], Decl(autoAccessor3.ts, 1, 22))
static accessor "y": any;
>"y" : Symbol(C1["y"], Decl(autoAccessor3.ts, 2, 21))
static accessor "z" = 2;
>"z" : Symbol(C1["z"], Decl(autoAccessor3.ts, 3, 29))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts ===
class C1 {
>C1 : C1
accessor "w": any;
>"w" : any
accessor "x" = 1;
>"x" : number
>1 : 1
static accessor "y": any;
>"y" : any
static accessor "z" = 2;
>"z" : number
>2 : 2
}
@@ -0,0 +1,24 @@
//// [autoAccessor3.ts]
class C1 {
accessor "w": any;
accessor "x" = 1;
static accessor "y": any;
static accessor "z" = 2;
}
//// [autoAccessor3.js]
class C1 {
#_a_accessor_storage;
get "w"() { return this.#_a_accessor_storage; }
set "w"(value) { this.#_a_accessor_storage = value; }
#_b_accessor_storage = 1;
get "x"() { return this.#_b_accessor_storage; }
set "x"(value) { this.#_b_accessor_storage = value; }
static #_c_accessor_storage;
static get "y"() { return this.#_c_accessor_storage; }
static set "y"(value) { this.#_c_accessor_storage = value; }
static #_d_accessor_storage = 2;
static get "z"() { return this.#_d_accessor_storage; }
static set "z"(value) { this.#_d_accessor_storage = value; }
}
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor3.ts, 0, 0))
accessor "w": any;
>"w" : Symbol(C1["w"], Decl(autoAccessor3.ts, 0, 10))
accessor "x" = 1;
>"x" : Symbol(C1["x"], Decl(autoAccessor3.ts, 1, 22))
static accessor "y": any;
>"y" : Symbol(C1["y"], Decl(autoAccessor3.ts, 2, 21))
static accessor "z" = 2;
>"z" : Symbol(C1["z"], Decl(autoAccessor3.ts, 3, 29))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts ===
class C1 {
>C1 : C1
accessor "w": any;
>"w" : any
accessor "x" = 1;
>"x" : number
>1 : 1
static accessor "y": any;
>"y" : any
static accessor "z" = 2;
>"z" : number
>2 : 2
}
@@ -0,0 +1,22 @@
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts (4 errors) ====
class C1 {
accessor "w": any;
~~~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
accessor "x" = 1;
~~~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
static accessor "y": any;
~~~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
static accessor "z" = 2;
~~~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
}
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor3.ts, 0, 0))
accessor "w": any;
>"w" : Symbol(C1["w"], Decl(autoAccessor3.ts, 0, 10))
accessor "x" = 1;
>"x" : Symbol(C1["x"], Decl(autoAccessor3.ts, 1, 22))
static accessor "y": any;
>"y" : Symbol(C1["y"], Decl(autoAccessor3.ts, 2, 21))
static accessor "z" = 2;
>"z" : Symbol(C1["z"], Decl(autoAccessor3.ts, 3, 29))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts ===
class C1 {
>C1 : C1
accessor "w": any;
>"w" : any
accessor "x" = 1;
>"x" : number
>1 : 1
static accessor "y": any;
>"y" : any
static accessor "z" = 2;
>"z" : number
>2 : 2
}
@@ -0,0 +1,16 @@
//// [autoAccessor3.ts]
class C1 {
accessor "w": any;
accessor "x" = 1;
static accessor "y": any;
static accessor "z" = 2;
}
//// [autoAccessor3.js]
class C1 {
accessor "w";
accessor "x" = 1;
static accessor "y";
static accessor "z" = 2;
}
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor3.ts, 0, 0))
accessor "w": any;
>"w" : Symbol(C1["w"], Decl(autoAccessor3.ts, 0, 10))
accessor "x" = 1;
>"x" : Symbol(C1["x"], Decl(autoAccessor3.ts, 1, 22))
static accessor "y": any;
>"y" : Symbol(C1["y"], Decl(autoAccessor3.ts, 2, 21))
static accessor "z" = 2;
>"z" : Symbol(C1["z"], Decl(autoAccessor3.ts, 3, 29))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor3.ts ===
class C1 {
>C1 : C1
accessor "w": any;
>"w" : any
accessor "x" = 1;
>"x" : number
>1 : 1
static accessor "y": any;
>"y" : any
static accessor "z" = 2;
>"z" : number
>2 : 2
}
@@ -0,0 +1,39 @@
//// [autoAccessor4.ts]
class C1 {
accessor 0: any;
accessor 1 = 1;
static accessor 2: any;
static accessor 3 = 2;
}
//// [autoAccessor4.js]
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage;
class C1 {
constructor() {
_C1__a_accessor_storage.set(this, void 0);
_C1__b_accessor_storage.set(this, 1);
}
get 0() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); }
set 0(value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); }
get 1() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); }
set 1(value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); }
static get 2() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); }
static set 2(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); }
static get 3() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); }
static set 3(value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); }
}
_a = C1, _C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap();
_C1__c_accessor_storage = { value: void 0 };
_C1__d_accessor_storage = { value: 2 };
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor4.ts, 0, 0))
accessor 0: any;
>0 : Symbol(C1[0], Decl(autoAccessor4.ts, 0, 10))
accessor 1 = 1;
>1 : Symbol(C1[1], Decl(autoAccessor4.ts, 1, 20))
static accessor 2: any;
>2 : Symbol(C1[2], Decl(autoAccessor4.ts, 2, 19))
static accessor 3 = 2;
>3 : Symbol(C1[3], Decl(autoAccessor4.ts, 3, 27))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts ===
class C1 {
>C1 : C1
accessor 0: any;
>0 : any
accessor 1 = 1;
>1 : number
>1 : 1
static accessor 2: any;
>2 : any
static accessor 3 = 2;
>3 : number
>2 : 2
}
@@ -0,0 +1,24 @@
//// [autoAccessor4.ts]
class C1 {
accessor 0: any;
accessor 1 = 1;
static accessor 2: any;
static accessor 3 = 2;
}
//// [autoAccessor4.js]
class C1 {
#_a_accessor_storage;
get 0() { return this.#_a_accessor_storage; }
set 0(value) { this.#_a_accessor_storage = value; }
#_b_accessor_storage = 1;
get 1() { return this.#_b_accessor_storage; }
set 1(value) { this.#_b_accessor_storage = value; }
static #_c_accessor_storage;
static get 2() { return this.#_c_accessor_storage; }
static set 2(value) { this.#_c_accessor_storage = value; }
static #_d_accessor_storage = 2;
static get 3() { return this.#_d_accessor_storage; }
static set 3(value) { this.#_d_accessor_storage = value; }
}
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor4.ts, 0, 0))
accessor 0: any;
>0 : Symbol(C1[0], Decl(autoAccessor4.ts, 0, 10))
accessor 1 = 1;
>1 : Symbol(C1[1], Decl(autoAccessor4.ts, 1, 20))
static accessor 2: any;
>2 : Symbol(C1[2], Decl(autoAccessor4.ts, 2, 19))
static accessor 3 = 2;
>3 : Symbol(C1[3], Decl(autoAccessor4.ts, 3, 27))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts ===
class C1 {
>C1 : C1
accessor 0: any;
>0 : any
accessor 1 = 1;
>1 : number
>1 : 1
static accessor 2: any;
>2 : any
static accessor 3 = 2;
>3 : number
>2 : 2
}
@@ -0,0 +1,22 @@
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts (4 errors) ====
class C1 {
accessor 0: any;
~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
accessor 1 = 1;
~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
static accessor 2: any;
~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
static accessor 3 = 2;
~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
}
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor4.ts, 0, 0))
accessor 0: any;
>0 : Symbol(C1[0], Decl(autoAccessor4.ts, 0, 10))
accessor 1 = 1;
>1 : Symbol(C1[1], Decl(autoAccessor4.ts, 1, 20))
static accessor 2: any;
>2 : Symbol(C1[2], Decl(autoAccessor4.ts, 2, 19))
static accessor 3 = 2;
>3 : Symbol(C1[3], Decl(autoAccessor4.ts, 3, 27))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts ===
class C1 {
>C1 : C1
accessor 0: any;
>0 : any
accessor 1 = 1;
>1 : number
>1 : 1
static accessor 2: any;
>2 : any
static accessor 3 = 2;
>3 : number
>2 : 2
}
@@ -0,0 +1,16 @@
//// [autoAccessor4.ts]
class C1 {
accessor 0: any;
accessor 1 = 1;
static accessor 2: any;
static accessor 3 = 2;
}
//// [autoAccessor4.js]
class C1 {
accessor 0;
accessor 1 = 1;
static accessor 2;
static accessor 3 = 2;
}
@@ -0,0 +1,17 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor4.ts, 0, 0))
accessor 0: any;
>0 : Symbol(C1[0], Decl(autoAccessor4.ts, 0, 10))
accessor 1 = 1;
>1 : Symbol(C1[1], Decl(autoAccessor4.ts, 1, 20))
static accessor 2: any;
>2 : Symbol(C1[2], Decl(autoAccessor4.ts, 2, 19))
static accessor 3 = 2;
>3 : Symbol(C1[3], Decl(autoAccessor4.ts, 3, 27))
}
@@ -0,0 +1,19 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor4.ts ===
class C1 {
>C1 : C1
accessor 0: any;
>0 : any
accessor 1 = 1;
>1 : number
>1 : 1
static accessor 2: any;
>2 : any
static accessor 3 = 2;
>3 : number
>2 : 2
}
@@ -0,0 +1,17 @@
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(10,14): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts (1 errors) ====
class C1 {
accessor ["w"]: any;
accessor ["x"] = 1;
static accessor ["y"]: any;
static accessor ["z"] = 2;
}
declare var f: any;
class C2 {
accessor [f()] = 1;
~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
}
@@ -0,0 +1,50 @@
//// [autoAccessor5.ts]
class C1 {
accessor ["w"]: any;
accessor ["x"] = 1;
static accessor ["y"]: any;
static accessor ["z"] = 2;
}
declare var f: any;
class C2 {
accessor [f()] = 1;
}
//// [autoAccessor5.js]
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _a, _C1__a_accessor_storage, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage, _C2__e_accessor_storage, _b;
class C1 {
constructor() {
_C1__a_accessor_storage.set(this, void 0);
_C1__b_accessor_storage.set(this, 1);
}
get [(_C1__a_accessor_storage = new WeakMap(), _C1__b_accessor_storage = new WeakMap(), "w")]() { return __classPrivateFieldGet(this, _C1__a_accessor_storage, "f"); }
set ["w"](value) { __classPrivateFieldSet(this, _C1__a_accessor_storage, value, "f"); }
get ["x"]() { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); }
set ["x"](value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); }
static get ["y"]() { return __classPrivateFieldGet(this, _a, "f", _C1__c_accessor_storage); }
static set ["y"](value) { __classPrivateFieldSet(this, _a, value, "f", _C1__c_accessor_storage); }
static get ["z"]() { return __classPrivateFieldGet(this, _a, "f", _C1__d_accessor_storage); }
static set ["z"](value) { __classPrivateFieldSet(this, _a, value, "f", _C1__d_accessor_storage); }
}
_a = C1;
_C1__c_accessor_storage = { value: void 0 };
_C1__d_accessor_storage = { value: 2 };
class C2 {
constructor() {
_C2__e_accessor_storage.set(this, 1);
}
get [(_C2__e_accessor_storage = new WeakMap(), _b = f(), _b)]() { return __classPrivateFieldGet(this, _C2__e_accessor_storage, "f"); }
set [_b](value) { __classPrivateFieldSet(this, _C2__e_accessor_storage, value, "f"); }
}
@@ -0,0 +1,31 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor5.ts, 0, 0))
accessor ["w"]: any;
>["w"] : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10))
>"w" : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10))
accessor ["x"] = 1;
>["x"] : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24))
>"x" : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24))
static accessor ["y"]: any;
>["y"] : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23))
>"y" : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23))
static accessor ["z"] = 2;
>["z"] : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31))
>"z" : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31))
}
declare var f: any;
>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11))
class C2 {
>C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19))
accessor [f()] = 1;
>[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10))
>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11))
}
@@ -0,0 +1,35 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts ===
class C1 {
>C1 : C1
accessor ["w"]: any;
>["w"] : any
>"w" : "w"
accessor ["x"] = 1;
>["x"] : number
>"x" : "x"
>1 : 1
static accessor ["y"]: any;
>["y"] : any
>"y" : "y"
static accessor ["z"] = 2;
>["z"] : number
>"z" : "z"
>2 : 2
}
declare var f: any;
>f : any
class C2 {
>C2 : C2
accessor [f()] = 1;
>[f()] : number
>f() : any
>f : any
>1 : 1
}
@@ -0,0 +1,17 @@
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(10,14): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts (1 errors) ====
class C1 {
accessor ["w"]: any;
accessor ["x"] = 1;
static accessor ["y"]: any;
static accessor ["z"] = 2;
}
declare var f: any;
class C2 {
accessor [f()] = 1;
~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
}
@@ -0,0 +1,34 @@
//// [autoAccessor5.ts]
class C1 {
accessor ["w"]: any;
accessor ["x"] = 1;
static accessor ["y"]: any;
static accessor ["z"] = 2;
}
declare var f: any;
class C2 {
accessor [f()] = 1;
}
//// [autoAccessor5.js]
var _a;
class C1 {
#_a_accessor_storage;
get ["w"]() { return this.#_a_accessor_storage; }
set ["w"](value) { this.#_a_accessor_storage = value; }
#_b_accessor_storage = 1;
get ["x"]() { return this.#_b_accessor_storage; }
set ["x"](value) { this.#_b_accessor_storage = value; }
static #_c_accessor_storage;
static get ["y"]() { return this.#_c_accessor_storage; }
static set ["y"](value) { this.#_c_accessor_storage = value; }
static #_d_accessor_storage = 2;
static get ["z"]() { return this.#_d_accessor_storage; }
static set ["z"](value) { this.#_d_accessor_storage = value; }
}
class C2 {
#_e_accessor_storage = 1;
get [(_a = f(), _a)]() { return this.#_e_accessor_storage; }
set [_a](value) { this.#_e_accessor_storage = value; }
}
@@ -0,0 +1,31 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor5.ts, 0, 0))
accessor ["w"]: any;
>["w"] : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10))
>"w" : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10))
accessor ["x"] = 1;
>["x"] : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24))
>"x" : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24))
static accessor ["y"]: any;
>["y"] : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23))
>"y" : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23))
static accessor ["z"] = 2;
>["z"] : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31))
>"z" : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31))
}
declare var f: any;
>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11))
class C2 {
>C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19))
accessor [f()] = 1;
>[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10))
>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11))
}
@@ -0,0 +1,35 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts ===
class C1 {
>C1 : C1
accessor ["w"]: any;
>["w"] : any
>"w" : "w"
accessor ["x"] = 1;
>["x"] : number
>"x" : "x"
>1 : 1
static accessor ["y"]: any;
>["y"] : any
>"y" : "y"
static accessor ["z"] = 2;
>["z"] : number
>"z" : "z"
>2 : 2
}
declare var f: any;
>f : any
class C2 {
>C2 : C2
accessor [f()] = 1;
>[f()] : number
>f() : any
>f : any
>1 : 1
}
@@ -0,0 +1,29 @@
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(2,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(3,14): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(4,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(5,21): error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(10,14): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts (5 errors) ====
class C1 {
accessor ["w"]: any;
~~~~~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
accessor ["x"] = 1;
~~~~~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
static accessor ["y"]: any;
~~~~~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
static accessor ["z"] = 2;
~~~~~
!!! error TS18045: Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.
}
declare var f: any;
class C2 {
accessor [f()] = 1;
~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
}
@@ -0,0 +1,81 @@
//// [autoAccessor5.ts]
class C1 {
accessor ["w"]: any;
accessor ["x"] = 1;
static accessor ["y"]: any;
static accessor ["z"] = 2;
}
declare var f: any;
class C2 {
accessor [f()] = 1;
}
//// [autoAccessor5.js]
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _C2__a_accessor_storage, _a;
var C1 = /** @class */ (function () {
function C1() {
_C1__b_accessor_storage.set(this, void 0);
_C1__c_accessor_storage.set(this, 1);
}
Object.defineProperty(C1.prototype, (_C1__b_accessor_storage = new WeakMap(), _C1__c_accessor_storage = new WeakMap(), "w"), {
get: function () { return __classPrivateFieldGet(this, _C1__b_accessor_storage, "f"); },
enumerable: false,
configurable: true
});
Object.defineProperty(C1.prototype, "w", {
set: function (value) { __classPrivateFieldSet(this, _C1__b_accessor_storage, value, "f"); },
enumerable: false,
configurable: true
});
Object.defineProperty(C1.prototype, "x", {
get: function () { return __classPrivateFieldGet(this, _C1__c_accessor_storage, "f"); },
set: function (value) { __classPrivateFieldSet(this, _C1__c_accessor_storage, value, "f"); },
enumerable: false,
configurable: true
});
Object.defineProperty(C1, "y", {
get: function () { return __classPrivateFieldGet(this, _b, "f", _C1__d_accessor_storage); },
set: function (value) { __classPrivateFieldSet(this, _b, value, "f", _C1__d_accessor_storage); },
enumerable: false,
configurable: true
});
Object.defineProperty(C1, "z", {
get: function () { return __classPrivateFieldGet(this, _b, "f", _C1__e_accessor_storage); },
set: function (value) { __classPrivateFieldSet(this, _b, value, "f", _C1__e_accessor_storage); },
enumerable: false,
configurable: true
});
var _b, _C1__b_accessor_storage, _C1__c_accessor_storage, _C1__d_accessor_storage, _C1__e_accessor_storage;
_b = C1;
_C1__d_accessor_storage = { value: void 0 };
_C1__e_accessor_storage = { value: 2 };
return C1;
}());
var C2 = /** @class */ (function () {
function C2() {
_C2__a_accessor_storage.set(this, 1);
}
Object.defineProperty(C2.prototype, (_C2__a_accessor_storage = new WeakMap(), _a = f(), _a), {
get: function () { return __classPrivateFieldGet(this, _C2__a_accessor_storage, "f"); },
enumerable: false,
configurable: true
});
Object.defineProperty(C2.prototype, _a, {
set: function (value) { __classPrivateFieldSet(this, _C2__a_accessor_storage, value, "f"); },
enumerable: false,
configurable: true
});
return C2;
}());
@@ -0,0 +1,31 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor5.ts, 0, 0))
accessor ["w"]: any;
>["w"] : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10))
>"w" : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10))
accessor ["x"] = 1;
>["x"] : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24))
>"x" : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24))
static accessor ["y"]: any;
>["y"] : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23))
>"y" : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23))
static accessor ["z"] = 2;
>["z"] : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31))
>"z" : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31))
}
declare var f: any;
>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11))
class C2 {
>C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19))
accessor [f()] = 1;
>[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10))
>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11))
}
@@ -0,0 +1,35 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts ===
class C1 {
>C1 : C1
accessor ["w"]: any;
>["w"] : any
>"w" : "w"
accessor ["x"] = 1;
>["x"] : number
>"x" : "x"
>1 : 1
static accessor ["y"]: any;
>["y"] : any
>"y" : "y"
static accessor ["z"] = 2;
>["z"] : number
>"z" : "z"
>2 : 2
}
declare var f: any;
>f : any
class C2 {
>C2 : C2
accessor [f()] = 1;
>[f()] : number
>f() : any
>f : any
>1 : 1
}
@@ -0,0 +1,17 @@
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts(10,14): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts (1 errors) ====
class C1 {
accessor ["w"]: any;
accessor ["x"] = 1;
static accessor ["y"]: any;
static accessor ["z"] = 2;
}
declare var f: any;
class C2 {
accessor [f()] = 1;
~~~~~
!!! error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type.
}
@@ -0,0 +1,23 @@
//// [autoAccessor5.ts]
class C1 {
accessor ["w"]: any;
accessor ["x"] = 1;
static accessor ["y"]: any;
static accessor ["z"] = 2;
}
declare var f: any;
class C2 {
accessor [f()] = 1;
}
//// [autoAccessor5.js]
class C1 {
accessor ["w"];
accessor ["x"] = 1;
static accessor ["y"];
static accessor ["z"] = 2;
}
class C2 {
accessor [f()] = 1;
}
@@ -0,0 +1,31 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor5.ts, 0, 0))
accessor ["w"]: any;
>["w"] : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10))
>"w" : Symbol(C1["w"], Decl(autoAccessor5.ts, 0, 10))
accessor ["x"] = 1;
>["x"] : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24))
>"x" : Symbol(C1["x"], Decl(autoAccessor5.ts, 1, 24))
static accessor ["y"]: any;
>["y"] : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23))
>"y" : Symbol(C1["y"], Decl(autoAccessor5.ts, 2, 23))
static accessor ["z"] = 2;
>["z"] : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31))
>"z" : Symbol(C1["z"], Decl(autoAccessor5.ts, 3, 31))
}
declare var f: any;
>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11))
class C2 {
>C2 : Symbol(C2, Decl(autoAccessor5.ts, 7, 19))
accessor [f()] = 1;
>[f()] : Symbol(C2[f()], Decl(autoAccessor5.ts, 8, 10))
>f : Symbol(f, Decl(autoAccessor5.ts, 7, 11))
}
@@ -0,0 +1,35 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor5.ts ===
class C1 {
>C1 : C1
accessor ["w"]: any;
>["w"] : any
>"w" : "w"
accessor ["x"] = 1;
>["x"] : number
>"x" : "x"
>1 : 1
static accessor ["y"]: any;
>["y"] : any
>"y" : "y"
static accessor ["z"] = 2;
>["z"] : number
>"z" : "z"
>2 : 2
}
declare var f: any;
>f : any
class C2 {
>C2 : C2
accessor [f()] = 1;
>[f()] : number
>f() : any
>f : any
>1 : 1
}
@@ -0,0 +1,18 @@
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property.
==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts (1 errors) ====
class C1 {
accessor a: any;
}
class C2 extends C1 {
a = 1;
~
!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property.
}
class C3 extends C1 {
get a() { return super.a; }
}
@@ -0,0 +1,44 @@
//// [autoAccessor6.ts]
class C1 {
accessor a: any;
}
class C2 extends C1 {
a = 1;
}
class C3 extends C1 {
get a() { return super.a; }
}
//// [autoAccessor6.js]
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _C1_a_accessor_storage;
class C1 {
constructor() {
_C1_a_accessor_storage.set(this, void 0);
}
get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); }
set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); }
}
_C1_a_accessor_storage = new WeakMap();
class C2 extends C1 {
constructor() {
super(...arguments);
this.a = 1;
}
}
class C3 extends C1 {
get a() { return super.a; }
}
@@ -0,0 +1,27 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0))
accessor a: any;
>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10))
}
class C2 extends C1 {
>C2 : Symbol(C2, Decl(autoAccessor6.ts, 2, 1))
>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0))
a = 1;
>a : Symbol(C2.a, Decl(autoAccessor6.ts, 4, 21))
}
class C3 extends C1 {
>C3 : Symbol(C3, Decl(autoAccessor6.ts, 6, 1))
>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0))
get a() { return super.a; }
>a : Symbol(C3.a, Decl(autoAccessor6.ts, 8, 21))
>super.a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10))
>super : Symbol(C1, Decl(autoAccessor6.ts, 0, 0))
>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10))
}
@@ -0,0 +1,28 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts ===
class C1 {
>C1 : C1
accessor a: any;
>a : any
}
class C2 extends C1 {
>C2 : C2
>C1 : C1
a = 1;
>a : number
>1 : 1
}
class C3 extends C1 {
>C3 : C3
>C1 : C1
get a() { return super.a; }
>a : any
>super.a : any
>super : C1
>a : any
}
@@ -0,0 +1,18 @@
tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts(6,5): error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property.
==== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts (1 errors) ====
class C1 {
accessor a: any;
}
class C2 extends C1 {
a = 1;
~
!!! error TS2610: 'a' is defined as an accessor in class 'C1', but is overridden here in 'C2' as an instance property.
}
class C3 extends C1 {
get a() { return super.a; }
}
@@ -0,0 +1,49 @@
//// [autoAccessor6.ts]
class C1 {
accessor a: any;
}
class C2 extends C1 {
a = 1;
}
class C3 extends C1 {
get a() { return super.a; }
}
//// [autoAccessor6.js]
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _C1_a_accessor_storage;
class C1 {
constructor() {
_C1_a_accessor_storage.set(this, void 0);
}
get a() { return __classPrivateFieldGet(this, _C1_a_accessor_storage, "f"); }
set a(value) { __classPrivateFieldSet(this, _C1_a_accessor_storage, value, "f"); }
}
_C1_a_accessor_storage = new WeakMap();
class C2 extends C1 {
constructor() {
super(...arguments);
Object.defineProperty(this, "a", {
enumerable: true,
configurable: true,
writable: true,
value: 1
});
}
}
class C3 extends C1 {
get a() { return super.a; }
}
@@ -0,0 +1,27 @@
=== tests/cases/conformance/classes/propertyMemberDeclarations/autoAccessor6.ts ===
class C1 {
>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0))
accessor a: any;
>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10))
}
class C2 extends C1 {
>C2 : Symbol(C2, Decl(autoAccessor6.ts, 2, 1))
>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0))
a = 1;
>a : Symbol(C2.a, Decl(autoAccessor6.ts, 4, 21))
}
class C3 extends C1 {
>C3 : Symbol(C3, Decl(autoAccessor6.ts, 6, 1))
>C1 : Symbol(C1, Decl(autoAccessor6.ts, 0, 0))
get a() { return super.a; }
>a : Symbol(C3.a, Decl(autoAccessor6.ts, 8, 21))
>super.a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10))
>super : Symbol(C1, Decl(autoAccessor6.ts, 0, 0))
>a : Symbol(C1.a, Decl(autoAccessor6.ts, 0, 10))
}
Loaded 100 of 196 files, more files were not shown because too many files have changed in this diff. Show more