tsc-ts 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api/compiler/ast.d.ts +57 -18
- package/dist/api/compiler/ast.js +134 -39
- package/dist/api/compiler/binder-utilities.js +2 -2
- package/dist/api/compiler/binder.js +6 -6
- package/dist/api/compiler/checker-calls.js +4 -4
- package/dist/api/compiler/checker-contextual.js +1 -1
- package/dist/api/compiler/checker-declaration-order.js +3 -2
- package/dist/api/compiler/checker-declared-types.js +6 -3
- package/dist/api/compiler/checker-deprecation.js +14 -13
- package/dist/api/compiler/checker-destructuring.js +3 -2
- package/dist/api/compiler/checker-emit-helpers.d.ts +2 -1
- package/dist/api/compiler/checker-emit-helpers.js +5 -4
- package/dist/api/compiler/checker-grammar.js +5 -5
- package/dist/api/compiler/checker-inference.d.ts +20 -10
- package/dist/api/compiler/checker-inference.js +48 -25
- package/dist/api/compiler/checker-members.d.ts +27 -0
- package/dist/api/compiler/checker-members.js +165 -0
- package/dist/api/compiler/checker-modules.d.ts +14 -0
- package/dist/api/compiler/checker-modules.js +73 -1
- package/dist/api/compiler/checker-symbol-types.js +5 -5
- package/dist/api/compiler/checker-symbols.js +3 -1
- package/dist/api/compiler/checker.d.ts +16 -0
- package/dist/api/compiler/checker.js +17 -0
- package/dist/api/compiler/diagnostics.js +9 -5
- package/dist/api/compiler/parallel-parse.js +3 -1
- package/dist/api/compiler/parser.d.ts +7 -0
- package/dist/api/compiler/parser.js +73 -41
- package/dist/api/compiler/printer/factory-base.js +8 -8
- package/dist/api/compiler/printer/factory.js +4 -4
- package/dist/api/compiler/printer/printer.js +6 -6
- package/dist/api/compiler/program-checker.d.ts +5 -0
- package/dist/api/compiler/program-checker.js +11 -1
- package/dist/api/compiler/relations.js +8 -3
- package/dist/api/compiler/reparser.js +13 -5
- package/dist/api/compiler/transformers/class-fields.js +3 -3
- package/dist/api/compiler/transformers/commonjs-module.js +3 -3
- package/dist/api/compiler/transformers/declarations-pseudo.js +2 -2
- package/dist/api/compiler/transformers/module.js +2 -2
- package/dist/api/compiler/transformers/optional-chain.js +3 -3
- package/dist/api/compiler/transformers/subtree-facts.js +2 -2
- package/dist/api/compiler/transformers/tagged-template.js +2 -2
- package/dist/api/compiler/transformers/type-eraser.js +2 -2
- package/dist/api/compiler/transformers/visitor-base.js +3 -3
- package/dist/api/compiler/tsconfig.js +2 -2
- package/package.json +9 -9
- package/src/compiler/ast.ts +184 -59
- package/src/compiler/binder-utilities.ts +2 -1
- package/src/compiler/binder.ts +11 -5
- package/src/compiler/checker-calls.ts +5 -3
- package/src/compiler/checker-contextual.ts +1 -1
- package/src/compiler/checker-declaration-order.ts +3 -2
- package/src/compiler/checker-declared-types.ts +6 -3
- package/src/compiler/checker-deprecation.ts +13 -11
- package/src/compiler/checker-destructuring.ts +11 -2
- package/src/compiler/checker-emit-helpers.ts +5 -4
- package/src/compiler/checker-grammar.ts +5 -3
- package/src/compiler/checker-inference.ts +49 -25
- package/src/compiler/checker-members.ts +164 -0
- package/src/compiler/checker-modules.ts +92 -1
- package/src/compiler/checker-symbol-types.ts +14 -4
- package/src/compiler/checker-symbols.ts +4 -1
- package/src/compiler/checker.ts +19 -0
- package/src/compiler/decoder.ts +5 -4
- package/src/compiler/diagnostics.ts +10 -5
- package/src/compiler/encoder.ts +10 -5
- package/src/compiler/parallel-parse.ts +3 -1
- package/src/compiler/parser.ts +93 -39
- package/src/compiler/printer/factory-base.ts +14 -7
- package/src/compiler/printer/factory.ts +5 -3
- package/src/compiler/printer/printer.ts +8 -6
- package/src/compiler/program-checker.ts +10 -1
- package/src/compiler/relations.ts +10 -2
- package/src/compiler/reparser.ts +14 -4
- package/src/compiler/transformers/class-fields.ts +12 -2
- package/src/compiler/transformers/commonjs-module.ts +3 -2
- package/src/compiler/transformers/declarations-pseudo.ts +2 -1
- package/src/compiler/transformers/declarations.ts +1 -1
- package/src/compiler/transformers/module.ts +2 -1
- package/src/compiler/transformers/optional-chain.ts +5 -2
- package/src/compiler/transformers/subtree-facts.ts +2 -1
- package/src/compiler/transformers/tagged-template.ts +2 -2
- package/src/compiler/transformers/type-eraser.ts +2 -1
- package/src/compiler/transformers/visitor-base.ts +10 -5
- package/src/compiler/tsconfig.ts +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-visitor.mjs; do not edit.
|
|
2
|
-
import { ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AwaitExpression, BinaryExpression, BindingElement, BindingPattern, Block, BreakStatement,
|
|
2
|
+
import { ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AwaitExpression, BinaryExpression, BindingElement, BindingPattern, Block, BreakStatement, CallSignatureDeclaration, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ContinueStatement, Decorator, DeleteExpression, DoStatement, ElementAccessExpression, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, IfStatement, ImportAttribute, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ImportTypeNode, IndexSignatureDeclaration, IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, JSDocDeprecatedTag, JSDocImplementsTag, JSDocImportTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocNameReference, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocOverloadTag, JSDocOverrideTag, JSDocParameterOrPropertyTag, JSDocPrivateTag, JSDocProtectedTag, JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSatisfiesTag, JSDocSeeTag, JSDocSignature, JSDocTemplateTag, JSDocThisTag, JSDocThrowsTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, JSDocTypedefTag, JSDocUnknownTag, JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxElement, JsxExpression, JsxFragment, JsxNamespacedName, JsxOpeningElement, JsxSelfClosingElement, JsxSpreadAttribute, LabeledStatement, LiteralTypeNode, MappedTypeNode, MetaProperty, MethodDeclaration, MethodSignatureDeclaration, MissingDeclaration, ModuleBlock, ModuleDeclaration, NamedExports, NamedImports, NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, NonNullExpression, ObjectLiteralExpression, OptionalTypeNode, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PropertyAccessExpression, PropertyDeclaration, PropertySignatureDeclaration, QualifiedName, RestTypeNode, ReturnStatement, SatisfiesExpression, SetAccessorDeclaration, ShorthandPropertyAssignment, SpreadAssignment, SpreadElement, SwitchStatement, SyntaxList, SyntheticReferenceExpression, TaggedTemplateExpression, TemplateExpression, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateSpan, ThrowStatement, TryStatement, TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, YieldExpression, propertyAssignmentPostfixToken, propertyAssignmentType, callQuestionDotToken, propertyAssignmentModifiers, callTypeArguments, newCallExpression, newPropertyAssignment, } from '../ast.js';
|
|
3
3
|
/** `update*` functions: return the node if no child changed, else a copy with the node's flags, range and original. */
|
|
4
4
|
export class NodeFactoryBase {
|
|
5
5
|
updateArrayLiteralExpression(node, elements, multiLine) {
|
|
@@ -97,11 +97,11 @@ export class NodeFactoryBase {
|
|
|
97
97
|
}
|
|
98
98
|
updateCallExpression(node, expression, questionDotToken, typeArguments, args, flags) {
|
|
99
99
|
if (expression !== node.expression ||
|
|
100
|
-
questionDotToken !== node
|
|
101
|
-
typeArguments !== node
|
|
100
|
+
questionDotToken !== callQuestionDotToken(node) ||
|
|
101
|
+
typeArguments !== callTypeArguments(node) ||
|
|
102
102
|
args !== node.arguments ||
|
|
103
103
|
flags !== node.flags) {
|
|
104
|
-
const updated =
|
|
104
|
+
const updated = newCallExpression(expression, questionDotToken, typeArguments, args, flags, false);
|
|
105
105
|
this.finishUpdate(updated, node);
|
|
106
106
|
return updated;
|
|
107
107
|
}
|
|
@@ -1154,12 +1154,12 @@ export class NodeFactoryBase {
|
|
|
1154
1154
|
return node;
|
|
1155
1155
|
}
|
|
1156
1156
|
updatePropertyAssignment(node, modifiers, name, postfixToken, typeNode, initializer) {
|
|
1157
|
-
if (modifiers !== node
|
|
1157
|
+
if (modifiers !== propertyAssignmentModifiers(node) ||
|
|
1158
1158
|
name !== node.name ||
|
|
1159
|
-
postfixToken !== node
|
|
1160
|
-
typeNode !== node
|
|
1159
|
+
postfixToken !== propertyAssignmentPostfixToken(node) ||
|
|
1160
|
+
typeNode !== propertyAssignmentType(node) ||
|
|
1161
1161
|
initializer !== node.initializer) {
|
|
1162
|
-
const updated =
|
|
1162
|
+
const updated = newPropertyAssignment(modifiers, name, postfixToken, typeNode, initializer, false);
|
|
1163
1163
|
this.finishUpdate(updated, node);
|
|
1164
1164
|
return updated;
|
|
1165
1165
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Creates synthesized nodes for transforms and the printer. Created nodes are flagged
|
|
2
2
|
// `Synthesized` and have no range; updated nodes keep the original's flags, range and emit data.
|
|
3
|
-
import { ArrowFunction, AsExpression, DeleteExpression, ExpressionWithTypeArguments, NonNullExpression, PartiallyEmittedExpression, SatisfiesExpression, SyntheticReferenceExpression, TypeAssertion, BinaryExpression, ElementAccessExpression, FunctionExpression, ObjectLiteralExpression, ParameterDeclaration, PrefixUnaryExpression,
|
|
3
|
+
import { ArrowFunction, AsExpression, DeleteExpression, ExpressionWithTypeArguments, NonNullExpression, PartiallyEmittedExpression, SatisfiesExpression, SyntheticReferenceExpression, TypeAssertion, BinaryExpression, ElementAccessExpression, FunctionExpression, ObjectLiteralExpression, ParameterDeclaration, PrefixUnaryExpression, QualifiedName, Block, CallExpression, ConditionalExpression, ExpressionStatement, Identifier, IfStatement, KeywordExpression, ModifierList, NodeList, NumericLiteral, ParenthesizedExpression, PrivateIdentifier, PropertyAccessExpression, ReturnStatement, SetAccessorDeclaration, SourceFile, StringLiteral, SyntaxList, Token, TypeOfExpression, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, newCallExpression, newPropertyAssignment, } from '../ast.js';
|
|
4
4
|
import { modifierToFlag } from '../ast-utilities.js';
|
|
5
5
|
import { getNameOfDeclaration, getNonAssignedNameOfDeclaration, hasSyntacticModifier } from '../binder-utilities.js';
|
|
6
6
|
import { AutoGenerateInfo, newAutoGenerateId } from './auto-generate.js';
|
|
@@ -83,7 +83,7 @@ export class NodeFactory extends NodeFactoryBase {
|
|
|
83
83
|
return this.created(new PropertyAccessExpression(expression, undefined, name, 0 /* NodeFlags.None */));
|
|
84
84
|
}
|
|
85
85
|
createCallExpression(expression, args) {
|
|
86
|
-
return this.created(
|
|
86
|
+
return this.created(newCallExpression(expression, undefined, undefined, this.createNodeList(args), 0 /* NodeFlags.None */, false));
|
|
87
87
|
}
|
|
88
88
|
createBinaryExpression(left, operator, right) {
|
|
89
89
|
return this.created(new BinaryExpression(undefined, left, undefined, this.createToken(operator), right));
|
|
@@ -146,7 +146,7 @@ export class NodeFactory extends NodeFactoryBase {
|
|
|
146
146
|
return this.created(new ObjectLiteralExpression(this.createNodeList(properties), multiLine));
|
|
147
147
|
}
|
|
148
148
|
createPropertyAssignment(name, initializer) {
|
|
149
|
-
return this.created(
|
|
149
|
+
return this.created(newPropertyAssignment(undefined, name, undefined, undefined, initializer, false));
|
|
150
150
|
}
|
|
151
151
|
createParameter(name) {
|
|
152
152
|
return this.created(new ParameterDeclaration(undefined, undefined, name, undefined, undefined, undefined));
|
|
@@ -362,7 +362,7 @@ export class NodeFactory extends NodeFactoryBase {
|
|
|
362
362
|
createMethodCall(object, method, args) {
|
|
363
363
|
const callee = this.createPropertyAccessExpression(object, this.createIdentifier(method));
|
|
364
364
|
const flags = object instanceof CallExpression ? object.flags & 32 /* NodeFlags.OptionalChain */ : 0 /* NodeFlags.None */;
|
|
365
|
-
return this.created(
|
|
365
|
+
return this.created(newCallExpression(callee, undefined, undefined, this.createNodeList(args), flags, false));
|
|
366
366
|
}
|
|
367
367
|
/** `Global.method(...args)`, such as `Math.pow(a, b)`. */
|
|
368
368
|
createGlobalMethodCall(global, method, args) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Prints syntax trees as source text the way tsgo's printer does: formatting, comments,
|
|
2
2
|
// source maps, generated names and emit helpers.
|
|
3
|
-
import { ArrayLiteralExpression, ArrowFunction, AsExpression, AwaitExpression, BinaryExpression, BindingElement, BindingPattern, Block, BreakStatement, CallExpression, CallSignatureDeclaration, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ContinueStatement, DebuggerStatement, Decorator, DeleteExpression, DoStatement, ElementAccessExpression, EmptyStatement, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, IfStatement, ImportAttribute, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ImportTypeNode, IndexSignatureDeclaration, IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxElement, JsxExpression, JsxFragment, JsxNamespacedName, JsxOpeningElement, JsxSelfClosingElement, JsxSpreadAttribute, JsxText, LabeledStatement, LiteralTypeNode, MappedTypeNode, MetaProperty, MethodDeclaration, MethodSignatureDeclaration, ModuleBlock, ModuleDeclaration, NamedExports, NamedImports, NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, NonNullExpression, NumericLiteral, ObjectLiteralExpression, OptionalTypeNode, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PrivateIdentifier, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertySignatureDeclaration, QualifiedName, RestTypeNode, ReturnStatement, SatisfiesExpression, SetAccessorDeclaration, ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, StringLiteral, SwitchStatement, TaggedTemplateExpression, TemplateExpression, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateSpan, ThrowStatement, TryStatement, TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, YieldExpression, ArrayTypeNode, getName, getParameters, getTypeParameters, getTypeArguments, getArguments, getElements, getProperties, getStatements, getModifiers, } from '../ast.js';
|
|
3
|
+
import { ArrayLiteralExpression, ArrowFunction, AsExpression, AwaitExpression, BinaryExpression, BindingElement, BindingPattern, Block, BreakStatement, CallExpression, CallSignatureDeclaration, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ContinueStatement, DebuggerStatement, Decorator, DeleteExpression, DoStatement, ElementAccessExpression, EmptyStatement, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, IfStatement, ImportAttribute, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ImportTypeNode, IndexSignatureDeclaration, IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxElement, JsxExpression, JsxFragment, JsxNamespacedName, JsxOpeningElement, JsxSelfClosingElement, JsxSpreadAttribute, JsxText, LabeledStatement, LiteralTypeNode, MappedTypeNode, MetaProperty, MethodDeclaration, MethodSignatureDeclaration, ModuleBlock, ModuleDeclaration, NamedExports, NamedImports, NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, NonNullExpression, NumericLiteral, ObjectLiteralExpression, OptionalTypeNode, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PrivateIdentifier, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertySignatureDeclaration, QualifiedName, RestTypeNode, ReturnStatement, SatisfiesExpression, SetAccessorDeclaration, ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, StringLiteral, SwitchStatement, TaggedTemplateExpression, TemplateExpression, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateSpan, ThrowStatement, TryStatement, TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, YieldExpression, ArrayTypeNode, getName, getParameters, getTypeParameters, getTypeArguments, getArguments, getElements, getProperties, getStatements, getModifiers, callQuestionDotToken, callTypeArguments, } from '../ast.js';
|
|
4
4
|
import { computeLineOfPosition, computeLineStarts, getLeadingCommentRanges, getShebang, getTrailingCommentRanges, skipTrivia, tokenToString, } from '../scanner.js';
|
|
5
5
|
import { ScriptTarget } from '../options.js';
|
|
6
6
|
import { fileExtensionIs } from '../path.js';
|
|
@@ -1728,8 +1728,8 @@ export class Printer extends NameGeneratorHost {
|
|
|
1728
1728
|
emitCallExpression(node) {
|
|
1729
1729
|
const state = this.enterNode(node);
|
|
1730
1730
|
this.emitCallee(node.expression, node);
|
|
1731
|
-
this.emitOptionalToken(node
|
|
1732
|
-
this.emitTypeArguments(node, node
|
|
1731
|
+
this.emitOptionalToken(callQuestionDotToken(node));
|
|
1732
|
+
this.emitTypeArguments(node, callTypeArguments(node));
|
|
1733
1733
|
this.emitList(13 /* ListItem.Argument */, node, node.arguments, 2576 /* ListFormat.CallExpressionArguments */);
|
|
1734
1734
|
this.exitNode(node, state);
|
|
1735
1735
|
return true;
|
|
@@ -2094,7 +2094,7 @@ export class Printer extends NameGeneratorHost {
|
|
|
2094
2094
|
if (node instanceof ElementAccessExpression)
|
|
2095
2095
|
return factory.updateElementAccessExpression(node, this.parenthesizeExpressionForNoAsi(node.expression), node.questionDotToken, node.argumentExpression, node.flags);
|
|
2096
2096
|
if (node instanceof CallExpression)
|
|
2097
|
-
return factory.updateCallExpression(node, this.parenthesizeExpressionForNoAsi(node.expression), node
|
|
2097
|
+
return factory.updateCallExpression(node, this.parenthesizeExpressionForNoAsi(node.expression), callQuestionDotToken(node), callTypeArguments(node), node.arguments, node.flags);
|
|
2098
2098
|
if (node instanceof TaggedTemplateExpression)
|
|
2099
2099
|
return factory.updateTaggedTemplateExpression(node, this.parenthesizeExpressionForNoAsi(node.tag), node.questionDotToken, node.typeArguments, node.template, node.flags);
|
|
2100
2100
|
if (node instanceof PostfixUnaryExpression)
|
|
@@ -2339,8 +2339,8 @@ export class Printer extends NameGeneratorHost {
|
|
|
2339
2339
|
this.write1('(');
|
|
2340
2340
|
this.emitExpression(call.expression, 0 /* OperatorPrecedence.Lowest */);
|
|
2341
2341
|
this.write1(')');
|
|
2342
|
-
this.emitOptionalToken(call
|
|
2343
|
-
this.emitTypeArguments(call, call
|
|
2342
|
+
this.emitOptionalToken(callQuestionDotToken(call));
|
|
2343
|
+
this.emitTypeArguments(call, callTypeArguments(call));
|
|
2344
2344
|
this.emitList(13 /* ListItem.Argument */, call, call.arguments, 2576 /* ListFormat.CallExpressionArguments */);
|
|
2345
2345
|
this.exitNode(call, callState);
|
|
2346
2346
|
}
|
|
@@ -24,6 +24,11 @@ import { type SourceFileMetadata } from './program-utilities.js';
|
|
|
24
24
|
export declare class ProgramCheckerHost extends CheckerHost {
|
|
25
25
|
readonly program: Program;
|
|
26
26
|
private specifierHost;
|
|
27
|
+
/**
|
|
28
|
+
* `getSourceFileForResolvedModule` by resolved file name (null when there is none): every import of
|
|
29
|
+
* a module asks again, and the program finds a file by its path, which it computes from the name.
|
|
30
|
+
*/
|
|
31
|
+
private readonly resolvedSourceFiles;
|
|
27
32
|
constructor(program: Program);
|
|
28
33
|
getCompilerOptions(): CompilerOptions;
|
|
29
34
|
getSourceFiles(): readonly SourceFile[];
|
|
@@ -9,6 +9,11 @@ import { computeLineOfPosition } from './scanner.js';
|
|
|
9
9
|
export class ProgramCheckerHost extends CheckerHost {
|
|
10
10
|
program;
|
|
11
11
|
specifierHost = undefined;
|
|
12
|
+
/**
|
|
13
|
+
* `getSourceFileForResolvedModule` by resolved file name (null when there is none): every import of
|
|
14
|
+
* a module asks again, and the program finds a file by its path, which it computes from the name.
|
|
15
|
+
*/
|
|
16
|
+
resolvedSourceFiles = new Map();
|
|
12
17
|
constructor(program) {
|
|
13
18
|
super();
|
|
14
19
|
this.program = program;
|
|
@@ -26,7 +31,12 @@ export class ProgramCheckerHost extends CheckerHost {
|
|
|
26
31
|
return this.program.getResolvedModule(file, moduleName, mode);
|
|
27
32
|
}
|
|
28
33
|
getSourceFileForResolvedModule(fileName) {
|
|
29
|
-
|
|
34
|
+
const known = this.resolvedSourceFiles.get(fileName);
|
|
35
|
+
if (known !== undefined)
|
|
36
|
+
return known ?? undefined;
|
|
37
|
+
const file = this.program.getSourceFileForResolvedModule(fileName);
|
|
38
|
+
this.resolvedSourceFiles.set(fileName, file ?? null);
|
|
39
|
+
return file;
|
|
30
40
|
}
|
|
31
41
|
getModeForUsageLocation(file, location) {
|
|
32
42
|
return this.program.getModeForUsageLocation(file, location);
|
|
@@ -10,7 +10,7 @@ import { createDiagnosticForNode } from './checker.js';
|
|
|
10
10
|
import { cachedTypeKey, emptyTypes, newTypeMapper, SimpleTypeMapper, } from './checker-types.js';
|
|
11
11
|
import { createInferenceContext, inferTypes } from './checker-inference.js';
|
|
12
12
|
import { unionContainsSortedTypes, unionContainsType, createArrayTypeEx, compareTypes, containsMissingType, createTypeReference, everyType, filterType, getBaseTypeOfLiteralType, getBaseTypeOfEnumLikeType, getElementTypes, getIntersectionType, getIntersectionTypeEx, getTargetType, getTypeArguments, getTypeReferenceArity, getUnionType, getUnionTypeEx, isArrayOrTupleType, isArrayType, isEmptyAnonymousObjectType, isEmptyObjectType, isErrorType, isFreshLiteralType, isGenericTupleType, isLiteralType, isMutableArrayOrTuple, isReadonlyArrayType, isTupleType, isUnitType, someType, tupleTargetOf, typesOf, countTypes, getStartElementCount, getEndElementCount, createNormalizedTypeReference, typeListKey, getRegularTypeOfLiteralType, } from './checker-type-factory.js';
|
|
13
|
-
import { findApplicableIndexInfo, getApparentType, getApplicableIndexInfo, getApplicableIndexInfoForName, getBaseConstraintOfType, getBaseConstraintOrType, getConstraintOfType, getDeclarationModifierFlagsFromSymbol, getIndexInfoOfType, getIndexInfosOfType, getIndexTypeOfType, getPropertiesOfObjectType, getPropertiesOfType, getPropertiesOfUnionOrIntersectionType, getPropertyOfObjectType, getPropertyOfType, getPropertyOfUnionOrIntersectionType, getReducedType, getSignaturesOfStructuredType, getSignaturesOfType, getTargetSymbol, getTypeOfPropertyOfType, getTypeWithThisArgument, getUnionOrIntersectionProperty, isApplicableIndexType, isArrayLikeType, isObjectLiteralType, isDiscriminantWithNeverType, isConflictingPrivateProperty, resolveStructuredTypeMembers, getResolvedMember, hasResolvedProperties, resolvedPropertiesAreOptional, } from './checker-members.js';
|
|
13
|
+
import { findApplicableIndexInfo, getApparentType, getApplicableIndexInfo, getApplicableIndexInfoForName, getBaseConstraintOfType, getBaseConstraintOrType, getConstraintOfType, getDeclarationModifierFlagsFromSymbol, getIndexInfoOfType, getIndexInfosOfType, getIndexTypeOfType, getPropertiesOfObjectType, getPropertiesOfType, getPropertiesOfUnionOrIntersectionType, getPropertyOfObjectType, getPropertyOfType, getPropertyOfUnionOrIntersectionType, getReducedType, getSignaturesOfStructuredType, getSignaturesOfType, getTargetSymbol, getTypeOfPropertyOfType, getTypeWithThisArgument, getUnionOrIntersectionProperty, isApplicableIndexType, isArrayLikeType, isObjectLiteralType, isDiscriminantWithNeverType, isConflictingPrivateProperty, resolveStructuredTypeMembers, getResolvedMember, hasResolvedProperties, resolvedPropertiesAreOptional, positionsOfNamesFoundInSource, firstUnmatchedProperty, } from './checker-members.js';
|
|
14
14
|
import { getParentOfSymbol, getMergedSymbol, getMembersOfSymbol, getSpellingSuggestionForName, } from './checker-symbols.js';
|
|
15
15
|
import { CodePoints, distanceToCandidate, utf8Length } from './spelling.js';
|
|
16
16
|
import { getConstraintFromTypeParameter, getDeclaredTypeOfSymbol, getDefaultOrUnknownFromTypeParameter, fillMissingTypeArguments, getMinTypeArgumentCount, hasBaseType, hasNonCircularBaseConstraint, computeEnumMemberValues, getBaseTypes, getExtendsHeritageClauseElement, } from './checker-declared-types.js';
|
|
@@ -2058,7 +2058,12 @@ export class Relater extends TypeComparer {
|
|
|
2058
2058
|
!isObjectLiteralType(source) &&
|
|
2059
2059
|
!isEmptyArrayLiteralType(c, source) &&
|
|
2060
2060
|
!isTupleType(source);
|
|
2061
|
-
const
|
|
2061
|
+
const targetProperties = getPropertiesOfType(c, target);
|
|
2062
|
+
// Where it is known which target names the source has, nothing else is looked up by name.
|
|
2063
|
+
const found = positionsOfNamesFoundInSource(c, source, target, targetProperties);
|
|
2064
|
+
const unmatchedProperty = found !== undefined
|
|
2065
|
+
? firstUnmatchedProperty(c, targetProperties, found, requireOptionalProperties)
|
|
2066
|
+
: getUnmatchedProperty(c, source, target, requireOptionalProperties, false);
|
|
2062
2067
|
if (unmatchedProperty !== undefined) {
|
|
2063
2068
|
if (reportErrors && shouldReportUnmatchedPropertyError(c, source, target))
|
|
2064
2069
|
this.reportUnmatchedProperty(source, target, unmatchedProperty, requireOptionalProperties);
|
|
@@ -2079,7 +2084,7 @@ export class Relater extends TypeComparer {
|
|
|
2079
2084
|
}
|
|
2080
2085
|
}
|
|
2081
2086
|
const numericNamesOnly = isTupleType(source) && isTupleType(target);
|
|
2082
|
-
for (const targetProp of
|
|
2087
|
+
for (const targetProp of found !== undefined ? found.map((i) => targetProperties[i]) : targetProperties) {
|
|
2083
2088
|
if (excludedProperties !== undefined && excludedProperties.has(targetProp.name))
|
|
2084
2089
|
continue;
|
|
2085
2090
|
const name = targetProp.name;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
//
|
|
7
7
|
// Fields of `instanceof`-narrowed nodes are read through `as` casts: scriptc reads them
|
|
8
8
|
// statically, but reads fields of a narrowed value dynamically.
|
|
9
|
-
import { ArrayTypeNode, ArrowFunction, AsExpression, BinaryExpression, CallSignatureDeclaration, ClassDeclaration, ClassExpression, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ElementAccessExpression, ExportAssignment, ExpressionStatement, ExpressionWithTypeArguments, FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, ImportDeclaration, IndexSignatureDeclaration, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, JSDocImplementsTag, JSDocImportTag, JSDocOverloadTag, JSDocParameterOrPropertyTag, JSDocSatisfiesTag, JSDocSignature, JSDocTemplateTag, JSDocThisTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypedefTag, JSDocVariadicType, JSDocOptionalType, KeywordTypeNode, MethodDeclaration, MethodSignatureDeclaration, ModifierList, ModuleBlock, ModuleDeclaration, NodeList, NodeVisitor, NumericLiteral, ParameterDeclaration, ParenthesizedExpression, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertySignatureDeclaration, QualifiedName, ReturnStatement, SatisfiesExpression, SetAccessorDeclaration, ShorthandPropertyAssignment, StringLiteral, Token, TypeAliasDeclaration, TypeLiteralNode, TypeParameterDeclaration, VariableDeclaration, VariableStatement, getComment, getModifiers, getName, getParameters, getText, getType, getTypeExpression, getTypeParameters, } from './ast.js';
|
|
9
|
+
import { ArrayTypeNode, ArrowFunction, AsExpression, BinaryExpression, CallSignatureDeclaration, ClassDeclaration, ClassExpression, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ElementAccessExpression, ExportAssignment, ExpressionStatement, ExpressionWithTypeArguments, FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, ImportDeclaration, IndexSignatureDeclaration, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, JSDocImplementsTag, JSDocImportTag, JSDocOverloadTag, JSDocParameterOrPropertyTag, JSDocSatisfiesTag, JSDocSignature, JSDocTemplateTag, JSDocThisTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypedefTag, JSDocVariadicType, JSDocOptionalType, KeywordTypeNode, MethodDeclaration, MethodSignatureDeclaration, ModifierList, ModuleBlock, ModuleDeclaration, NodeList, NodeVisitor, NumericLiteral, ParameterDeclaration, ParenthesizedExpression, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertySignatureDeclaration, QualifiedName, ReturnStatement, SatisfiesExpression, SetAccessorDeclaration, ShorthandPropertyAssignment, StringLiteral, Token, TypeAliasDeclaration, TypeLiteralNode, TypeParameterDeclaration, VariableDeclaration, VariableStatement, getComment, getModifiers, getName, getParameters, getText, getType, getTypeExpression, getTypeParameters, FullPropertyAssignment, } from './ast.js';
|
|
10
10
|
import { isAssignmentOperator, isFunctionLike, isInJSFile, isLeftHandSideExpression, isStringLiteralLike, } from './ast-utilities.js';
|
|
11
11
|
import { isIdentifierPart, isIdentifierStart } from './character-codes.js';
|
|
12
12
|
/** Sets the parent of every node in a subtree. */
|
|
@@ -652,10 +652,14 @@ export class Reparser {
|
|
|
652
652
|
return false;
|
|
653
653
|
const className = tag.className;
|
|
654
654
|
const heritageClauses = getHeritageClauses(parent);
|
|
655
|
+
// Parsed lists may share their nodes array (empty ones do), so a longer list is a new list.
|
|
655
656
|
if (heritageClauses !== undefined) {
|
|
656
657
|
for (const clause of heritageClauses.nodes)
|
|
657
658
|
if (clause instanceof HeritageClause && clause.token === 118 /* SyntaxKind.ImplementsKeyword */) {
|
|
658
|
-
clause.types
|
|
659
|
+
const types = clause.types;
|
|
660
|
+
const nodes = types.nodes.slice();
|
|
661
|
+
nodes.push(this.addDeepCloneReparse(className));
|
|
662
|
+
clause.types = this.p.newNodeList(types.pos, types.end, nodes);
|
|
659
663
|
this.finishMutatedNode(clause);
|
|
660
664
|
return true;
|
|
661
665
|
}
|
|
@@ -665,8 +669,11 @@ export class Reparser {
|
|
|
665
669
|
this.finishReparsedNode(heritageClause, className);
|
|
666
670
|
if (heritageClauses === undefined)
|
|
667
671
|
setHeritageClauses(parent, this.p.newNodeList(className.pos, className.end, [heritageClause]));
|
|
668
|
-
else
|
|
669
|
-
heritageClauses.nodes.
|
|
672
|
+
else {
|
|
673
|
+
const nodes = heritageClauses.nodes.slice();
|
|
674
|
+
nodes.push(heritageClause);
|
|
675
|
+
setHeritageClauses(parent, this.p.newNodeList(heritageClauses.pos, heritageClauses.end, nodes));
|
|
676
|
+
}
|
|
670
677
|
this.finishMutatedNode(parent);
|
|
671
678
|
return true;
|
|
672
679
|
}
|
|
@@ -1178,7 +1185,8 @@ function setType(node, value) {
|
|
|
1178
1185
|
node.type = value;
|
|
1179
1186
|
return true;
|
|
1180
1187
|
}
|
|
1181
|
-
|
|
1188
|
+
// Property assignments in JavaScript files, which are the ones reparsed, are full ones.
|
|
1189
|
+
if (node instanceof FullPropertyAssignment) {
|
|
1182
1190
|
node.type = value;
|
|
1183
1191
|
return true;
|
|
1184
1192
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Lowers class fields, private names, static blocks and `accessor` fields: initializers move to
|
|
2
2
|
// the constructor (useDefineForClassFields: false, or targets before ES2022), private members
|
|
3
3
|
// become WeakMaps, WeakSets and hoisted functions, and static `this` and `super` refer to the class.
|
|
4
|
-
import { ArrayLiteralExpression, BinaryExpression, Block, CallExpression, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, ComputedPropertyName, ConstructorDeclaration, ElementAccessExpression, ExportAssignment, ExpressionWithTypeArguments, GetAccessorDeclaration, HeritageClause, Identifier, NodeList, ObjectLiteralExpression, ParameterDeclaration, ParenthesizedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PrivateIdentifier, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, SetAccessorDeclaration, ShorthandPropertyAssignment, SpreadAssignment, SpreadElement, StringLiteral, TryStatement, NewExpression, ArrowFunction, CatchClause, FunctionExpression, MethodDeclaration, NodeVisitor, VoidExpression, getBody, getParameters, getInitializer, getMembers, getModifiers, getName, } from '../ast.js';
|
|
4
|
+
import { ArrayLiteralExpression, BinaryExpression, Block, CallExpression, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, ComputedPropertyName, ConstructorDeclaration, ElementAccessExpression, ExportAssignment, ExpressionWithTypeArguments, GetAccessorDeclaration, HeritageClause, Identifier, NodeList, ObjectLiteralExpression, ParameterDeclaration, ParenthesizedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PrivateIdentifier, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, SetAccessorDeclaration, ShorthandPropertyAssignment, SpreadAssignment, SpreadElement, StringLiteral, TryStatement, NewExpression, ArrowFunction, CatchClause, FunctionExpression, MethodDeclaration, NodeVisitor, VoidExpression, getBody, getParameters, getInitializer, getMembers, getModifiers, getName, callQuestionDotToken, callTypeArguments, newCallExpression, } from '../ast.js';
|
|
5
5
|
import { isLeftHandSideExpression } from '../ast-utilities.js';
|
|
6
6
|
import { getNameOfDeclaration, hasStaticModifier, isAssignmentExpression, isAutoAccessorPropertyDeclaration, isClassLike, isDestructuringAssignment, isMethodOrAccessor, isPrivateIdentifierClassElementDeclaration, isStatic, skipParentheses, } from '../binder-utilities.js';
|
|
7
7
|
import { isIdentifierText } from '../scanner.js';
|
|
@@ -963,7 +963,7 @@ export class ClassFieldsTransformer extends Transformer {
|
|
|
963
963
|
if (node instanceof ParenthesizedExpression)
|
|
964
964
|
return factory.cloneNode(node, new ParenthesizedExpression(node.expression));
|
|
965
965
|
if (node instanceof CallExpression)
|
|
966
|
-
return factory.cloneNode(node,
|
|
966
|
+
return factory.cloneNode(node, newCallExpression(node.expression, callQuestionDotToken(node), callTypeArguments(node), node.arguments, node.flags, false));
|
|
967
967
|
return factory.cloneNode(node, node.deepClone());
|
|
968
968
|
}
|
|
969
969
|
visitCallExpression(node) {
|
|
@@ -980,7 +980,7 @@ export class ClassFieldsTransformer extends Transformer {
|
|
|
980
980
|
for (let i = 0; i < visitedArgs.length; i++)
|
|
981
981
|
args.push(visitedArgs[i]);
|
|
982
982
|
const optional = (node.flags & 32 /* NodeFlags.OptionalChain */) !== 0;
|
|
983
|
-
const call = factory.created(new PropertyAccessExpression(target, optional ? node
|
|
983
|
+
const call = factory.created(new PropertyAccessExpression(target, optional ? callQuestionDotToken(node) : undefined, factory.createIdentifier('call'), optional ? 32 /* NodeFlags.OptionalChain */ : 0 /* NodeFlags.None */));
|
|
984
984
|
return factory.updateCallExpression(node, call, undefined, undefined, factory.createNodeList(args), node.flags);
|
|
985
985
|
}
|
|
986
986
|
const data = this.staticSuperData(callee);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// CommonJS module output: imports become `require` calls, exports assignments to `exports`.
|
|
2
|
-
import { ArrowFunction, BinaryExpression, BindingPattern, Block, CallExpression, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, ClassExpression, DoStatement, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExternalModuleReference, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, LabeledStatement, NamedExports, NamespaceExport, NodeList, NodeVisitor, ObjectLiteralExpression, ArrayLiteralExpression, ParenthesizedExpression, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PropertyAssignment, ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, StringLiteral, SwitchStatement, TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateSpan, TemplateTail, TryStatement, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, EmptyStatement, getElements, getName, } from '../ast.js';
|
|
2
|
+
import { ArrowFunction, BinaryExpression, BindingPattern, Block, CallExpression, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, ClassExpression, DoStatement, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExternalModuleReference, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, LabeledStatement, NamedExports, NamespaceExport, NodeList, NodeVisitor, ObjectLiteralExpression, ArrayLiteralExpression, ParenthesizedExpression, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PropertyAssignment, ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, StringLiteral, SwitchStatement, TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateSpan, TemplateTail, TryStatement, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, EmptyStatement, getElements, getName, callQuestionDotToken, } from '../ast.js';
|
|
3
3
|
import { getExternalModuleName, isImportCall, isInJSFile, isRequireCall } from '../ast-utilities.js';
|
|
4
4
|
import { isAssignmentExpression, isDestructuringAssignment } from '../binder-utilities.js';
|
|
5
5
|
import { JsxEmit, ModuleKind, ScriptTarget, getEmitModuleKind, getEmitScriptTarget, } from '../options.js';
|
|
@@ -869,7 +869,7 @@ export class CommonJSModuleTransformer extends Transformer {
|
|
|
869
869
|
const callee = node.expression;
|
|
870
870
|
if (callee instanceof Identifier) {
|
|
871
871
|
const expression = this.visitExpressionIdentifier(callee);
|
|
872
|
-
const updated = this.factory.updateCallExpression(node, expression, node
|
|
872
|
+
const updated = this.factory.updateCallExpression(node, expression, callQuestionDotToken(node), undefined, this.visitNodes(node.arguments), node.flags);
|
|
873
873
|
if (!(expression instanceof Identifier) && (this.context.getEmitFlags(callee) & 1024 /* EmitFlags.HelperName */) === 0)
|
|
874
874
|
this.context.addEmitFlags(updated, 1048576 /* EmitFlags.IndirectCall */);
|
|
875
875
|
return updated;
|
|
@@ -938,7 +938,7 @@ export class CommonJSModuleTransformer extends Transformer {
|
|
|
938
938
|
if (rewritten !== first || visitedRest !== rest)
|
|
939
939
|
args = new NodeList(args.pos, args.end, [rewritten].concat(visitedRest));
|
|
940
940
|
}
|
|
941
|
-
return factory.updateCallExpression(node, expression, node
|
|
941
|
+
return factory.updateCallExpression(node, expression, callQuestionDotToken(node), undefined, args, node.flags);
|
|
942
942
|
}
|
|
943
943
|
visitTaggedTemplateExpression(node) {
|
|
944
944
|
const tag = node.tag;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// pseudochecker and the isolatedDeclarations rules. Annotations, literals, `as const` values
|
|
3
3
|
// and function expressions with annotated returns have pseudo-types; everything else is
|
|
4
4
|
// "inferred" and needs the checker.
|
|
5
|
-
import { ArrayLiteralExpression, ArrowFunction, FunctionExpression, MethodDeclaration, GetAccessorDeclaration, NodeVisitor, ObjectLiteralExpression, ParameterDeclaration, PrefixUnaryExpression, PropertyAssignment, PropertyDeclaration, ReturnStatement, SetAccessorDeclaration, TypeReferenceNode, VariableDeclaration, UnionTypeNode, IntersectionTypeNode, getAsteriskToken, getBody, getExpression, getName, getParameters, getPostfixToken, getSymbol, getType, getTypeParameters, } from '../ast.js';
|
|
5
|
+
import { ArrayLiteralExpression, ArrowFunction, FunctionExpression, MethodDeclaration, GetAccessorDeclaration, NodeVisitor, ObjectLiteralExpression, ParameterDeclaration, PrefixUnaryExpression, PropertyAssignment, PropertyDeclaration, ReturnStatement, SetAccessorDeclaration, TypeReferenceNode, VariableDeclaration, UnionTypeNode, IntersectionTypeNode, getAsteriskToken, getBody, getExpression, getName, getParameters, getPostfixToken, getSymbol, getType, getTypeParameters, propertyAssignmentPostfixToken, } from '../ast.js';
|
|
6
6
|
import { isFunctionLike, nodeIsMissing } from '../ast-utilities.js';
|
|
7
7
|
import { getCombinedNodeFlags, hasSyntacticModifier, isIdentifierNamed } from '../binder-utilities.js';
|
|
8
8
|
import { getAllAccessorDeclarations } from './declarations-diagnostics.js';
|
|
@@ -416,7 +416,7 @@ export class PseudoChecker {
|
|
|
416
416
|
}
|
|
417
417
|
case 303 /* SyntaxKind.PropertyAssignment */: {
|
|
418
418
|
const assignment = property;
|
|
419
|
-
const postfix = assignment
|
|
419
|
+
const postfix = propertyAssignmentPostfixToken(assignment);
|
|
420
420
|
members.push(new PseudoMember(1 /* PseudoMemberKind.Property */, assignment.name, postfix !== undefined && postfix.kind === 57 /* SyntaxKind.QuestionToken */, false, undefined, [], [], this.typeFromExpression(assignment.initializer)));
|
|
421
421
|
break;
|
|
422
422
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// `"use strict"` prologues and module output: ECMAScript modules, CommonJS, or each file in the
|
|
2
2
|
// format its extension and package.json imply.
|
|
3
|
-
import { CallExpression, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExternalModuleReference, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, MetaProperty, NamedExports, NamedImports, NamespaceExport, NamespaceImport, NodeList, SourceFile, StringLiteral, NoSubstitutionTemplateLiteral, Identifier, } from '../ast.js';
|
|
3
|
+
import { CallExpression, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExternalModuleReference, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, MetaProperty, NamedExports, NamedImports, NamespaceExport, NamespaceImport, NodeList, SourceFile, StringLiteral, NoSubstitutionTemplateLiteral, Identifier, callQuestionDotToken, } from '../ast.js';
|
|
4
4
|
import { isAnyImportOrReExport, isImportCall, isInJSFile, isRequireCall } from '../ast-utilities.js';
|
|
5
5
|
import { JsxEmit, ModuleKind, getEmitModuleKind, getIsolatedModules } from '../options.js';
|
|
6
6
|
import { isPrologueDirective } from '../printer/utilities.js';
|
|
@@ -257,7 +257,7 @@ export class ESModuleTransformer extends Transformer {
|
|
|
257
257
|
? rewriteModuleSpecifier(this.context, first, this.options)
|
|
258
258
|
: factory.createRewriteRelativeImportExtensionsHelper(first, this.options.jsx === JsxEmit.Preserve);
|
|
259
259
|
const rest = this.visitArray(args.slice(1));
|
|
260
|
-
return factory.updateCallExpression(node, this.visitNode(node.expression), node
|
|
260
|
+
return factory.updateCallExpression(node, this.visitNode(node.expression), callQuestionDotToken(node), undefined, new NodeList(node.arguments.pos, node.arguments.end, [argument].concat(rest)), node.flags);
|
|
261
261
|
}
|
|
262
262
|
importAttributes(node) {
|
|
263
263
|
const visited = this.visitNode(node);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Lowers optional chains such as `a?.b.c()` to conditionals on `null` and `undefined` (ES2020).
|
|
2
|
-
import { CallExpression, DeleteExpression, ElementAccessExpression, ParenthesizedExpression, PropertyAccessExpression, SyntheticReferenceExpression, TaggedTemplateExpression, } from '../ast.js';
|
|
2
|
+
import { CallExpression, DeleteExpression, ElementAccessExpression, ParenthesizedExpression, PropertyAccessExpression, SyntheticReferenceExpression, TaggedTemplateExpression, callQuestionDotToken, newCallExpression, } from '../ast.js';
|
|
3
3
|
import { skipParentheses } from '../binder-utilities.js';
|
|
4
4
|
import { skipPartiallyEmittedExpressions } from '../printer/utilities.js';
|
|
5
5
|
import { isSimpleCopiableExpression } from './destructuring.js';
|
|
@@ -147,7 +147,7 @@ export class OptionalChainTransformer extends Transformer {
|
|
|
147
147
|
rightExpression = factory.createFunctionCallCall(rightExpression, callThisArg, this.visitNodes(segment.arguments).nodes);
|
|
148
148
|
}
|
|
149
149
|
else
|
|
150
|
-
rightExpression = factory.created(
|
|
150
|
+
rightExpression = factory.created(newCallExpression(rightExpression, undefined, undefined, this.visitNodes(segment.arguments), 0 /* NodeFlags.None */, false));
|
|
151
151
|
}
|
|
152
152
|
context.setOriginal(rightExpression, segment);
|
|
153
153
|
}
|
|
@@ -169,7 +169,7 @@ function questionDotTokenOf(node) {
|
|
|
169
169
|
if (node instanceof ElementAccessExpression)
|
|
170
170
|
return node.questionDotToken;
|
|
171
171
|
if (node instanceof CallExpression)
|
|
172
|
-
return node
|
|
172
|
+
return callQuestionDotToken(node);
|
|
173
173
|
return undefined;
|
|
174
174
|
}
|
|
175
175
|
/** The expression a link of a chain accesses or calls. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Whether a subtree contains TypeScript-only syntax, computed as tsgo's subtree facts are.
|
|
2
2
|
// Transforms skip subtrees without it; that also decides how malformed code is emitted.
|
|
3
|
-
import { ClassDeclaration, ClassExpression, ConstructorDeclaration, ExportAssignment, ExportDeclaration, ExportSpecifier, FunctionDeclaration, GetAccessorDeclaration, Identifier, ImportClause, ImportEqualsDeclaration, ImportSpecifier, MethodDeclaration, NodeVisitor, ParameterDeclaration, PropertyDeclaration, SetAccessorDeclaration, VariableDeclaration, VariableStatement, ArrowFunction, FunctionExpression, CallExpression, NewExpression, TaggedTemplateExpression, ExpressionWithTypeArguments, JsxOpeningElement, JsxSelfClosingElement, HeritageClause, getModifiers, } from '../ast.js';
|
|
3
|
+
import { ClassDeclaration, ClassExpression, ConstructorDeclaration, ExportAssignment, ExportDeclaration, ExportSpecifier, FunctionDeclaration, GetAccessorDeclaration, Identifier, ImportClause, ImportEqualsDeclaration, ImportSpecifier, MethodDeclaration, NodeVisitor, ParameterDeclaration, PropertyDeclaration, SetAccessorDeclaration, VariableDeclaration, VariableStatement, ArrowFunction, FunctionExpression, CallExpression, NewExpression, TaggedTemplateExpression, ExpressionWithTypeArguments, JsxOpeningElement, JsxSelfClosingElement, HeritageClause, getModifiers, callTypeArguments, } from '../ast.js';
|
|
4
4
|
import { ClusteredIntLinkTable } from '../link-tables.js';
|
|
5
5
|
import { isTypeNodeKind } from '../printer/utilities.js';
|
|
6
6
|
/** Memoized `containsTypeScript` answers for one emit. */
|
|
@@ -185,7 +185,7 @@ function ownFacts(node) {
|
|
|
185
185
|
? 1 /* Facts.TypeScript */
|
|
186
186
|
: 0 /* Facts.None */;
|
|
187
187
|
case 214 /* SyntaxKind.CallExpression */:
|
|
188
|
-
return node instanceof CallExpression && node
|
|
188
|
+
return node instanceof CallExpression && callTypeArguments(node) !== undefined ? 1 /* Facts.TypeScript */ : 0 /* Facts.None */;
|
|
189
189
|
case 215 /* SyntaxKind.NewExpression */:
|
|
190
190
|
return node instanceof NewExpression && node.typeArguments !== undefined ? 1 /* Facts.TypeScript */ : 0 /* Facts.None */;
|
|
191
191
|
case 216 /* SyntaxKind.TaggedTemplateExpression */:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Lowers tagged templates with invalid escapes, allowed in tagged templates since ES2018, to
|
|
2
2
|
// calls with a `__makeTemplateObject` template object.
|
|
3
|
-
import { ArrayLiteralExpression,
|
|
3
|
+
import { ArrayLiteralExpression, NoSubstitutionTemplateLiteral, SourceFile, TaggedTemplateExpression, TemplateExpression, TemplateMiddle, TemplateTail, newCallExpression, } from '../ast.js';
|
|
4
4
|
import { getSourceTextOfNode } from '../printer/utilities.js';
|
|
5
5
|
import { Transformer } from './transformer.js';
|
|
6
6
|
import { isExternalModule } from './utilities.js';
|
|
@@ -83,7 +83,7 @@ export class TaggedTemplateTransformer extends Transformer {
|
|
|
83
83
|
templateObject = factory.createLogicalOr(name, factory.createAssignment(name, helperCall));
|
|
84
84
|
}
|
|
85
85
|
args.unshift(templateObject);
|
|
86
|
-
const call = factory.created(
|
|
86
|
+
const call = factory.created(newCallExpression(tag, undefined, undefined, factory.createNodeList(args), 0, false));
|
|
87
87
|
call.pos = node.pos;
|
|
88
88
|
call.end = node.end;
|
|
89
89
|
return call;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Removes TypeScript-only syntax: type annotations and declarations, `declare`d statements,
|
|
2
2
|
// type-only imports and exports, and modifiers such as `public` and `readonly`.
|
|
3
|
-
import { CallExpression, ClassDeclaration, ClassExpression, ConstructorDeclaration, ExportDeclaration, ExportSpecifier, ExpressionWithTypeArguments, FunctionDeclaration, FunctionExpression, GetAccessorDeclaration, HeritageClause, Identifier, ImportClause, ImportDeclaration, ImportAttributes, ImportEqualsDeclaration, ImportSpecifier, JsxAttributes, JsxOpeningElement, JsxSelfClosingElement, MethodDeclaration, ModuleDeclaration, NamedExports, NamedImports, NewExpression, ParameterDeclaration, ParenthesizedExpression, PartiallyEmittedExpression, PropertyDeclaration, SetAccessorDeclaration, TaggedTemplateExpression, VariableDeclaration, ArrowFunction, getExpression, } from '../ast.js';
|
|
3
|
+
import { CallExpression, ClassDeclaration, ClassExpression, ConstructorDeclaration, ExportDeclaration, ExportSpecifier, ExpressionWithTypeArguments, FunctionDeclaration, FunctionExpression, GetAccessorDeclaration, HeritageClause, Identifier, ImportClause, ImportDeclaration, ImportAttributes, ImportEqualsDeclaration, ImportSpecifier, JsxAttributes, JsxOpeningElement, JsxSelfClosingElement, MethodDeclaration, ModuleDeclaration, NamedExports, NamedImports, NewExpression, ParameterDeclaration, ParenthesizedExpression, PartiallyEmittedExpression, PropertyDeclaration, SetAccessorDeclaration, TaggedTemplateExpression, VariableDeclaration, ArrowFunction, getExpression, callQuestionDotToken, } from '../ast.js';
|
|
4
4
|
import { nodeIsMissing } from '../ast-utilities.js';
|
|
5
5
|
import { shouldPreserveConstEnums } from '../options.js';
|
|
6
6
|
import { isStatement } from '../printer/utilities.js';
|
|
@@ -176,7 +176,7 @@ export class TypeEraser extends Transformer {
|
|
|
176
176
|
break;
|
|
177
177
|
case 214 /* SyntaxKind.CallExpression */:
|
|
178
178
|
if (node instanceof CallExpression)
|
|
179
|
-
return factory.updateCallExpression(node, this.required(node.expression), node
|
|
179
|
+
return factory.updateCallExpression(node, this.required(node.expression), callQuestionDotToken(node), undefined, this.visitNodes(node.arguments), node.flags);
|
|
180
180
|
break;
|
|
181
181
|
case 215 /* SyntaxKind.NewExpression */:
|
|
182
182
|
if (node instanceof NewExpression)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-visitor.mjs; do not edit.
|
|
2
|
-
import { ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AwaitExpression, BinaryExpression, BindingElement, BindingPattern, Block, BreakStatement, CallExpression, CallSignatureDeclaration, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ContinueStatement, Decorator, DeleteExpression, DoStatement, ElementAccessExpression, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, IfStatement, ImportAttribute, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ImportTypeNode, IndexSignatureDeclaration, IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, JSDocDeprecatedTag, JSDocImplementsTag, JSDocImportTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocNameReference, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocOverloadTag, JSDocOverrideTag, JSDocParameterOrPropertyTag, JSDocPrivateTag, JSDocProtectedTag, JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSatisfiesTag, JSDocSeeTag, JSDocSignature, JSDocTemplateTag, JSDocThisTag, JSDocThrowsTag, JSDocTypeExpression, JSDocTypeTag, JSDocTypedefTag, JSDocUnknownTag, JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxClosingFragment, JsxElement, JsxExpression, JsxFragment, JsxNamespacedName, JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, JsxSpreadAttribute, LabeledStatement, LiteralTypeNode, MappedTypeNode, MetaProperty, MethodDeclaration, MethodSignatureDeclaration, MissingDeclaration, ModuleBlock, ModuleDeclaration, NamedExports, NamedImports, NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, NonNullExpression, ObjectLiteralExpression, OptionalTypeNode, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertySignatureDeclaration, QualifiedName, RestTypeNode, ReturnStatement, SatisfiesExpression, SetAccessorDeclaration, ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, SwitchStatement, SyntheticReferenceExpression, TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateSpan, ThrowStatement, Token, TryStatement, TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, YieldExpression, } from '../ast.js';
|
|
2
|
+
import { ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AwaitExpression, BinaryExpression, BindingElement, BindingPattern, Block, BreakStatement, CallExpression, CallSignatureDeclaration, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ContinueStatement, Decorator, DeleteExpression, DoStatement, ElementAccessExpression, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, IfStatement, ImportAttribute, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ImportTypeNode, IndexSignatureDeclaration, IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, JSDocDeprecatedTag, JSDocImplementsTag, JSDocImportTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocNameReference, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocOverloadTag, JSDocOverrideTag, JSDocParameterOrPropertyTag, JSDocPrivateTag, JSDocProtectedTag, JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSatisfiesTag, JSDocSeeTag, JSDocSignature, JSDocTemplateTag, JSDocThisTag, JSDocThrowsTag, JSDocTypeExpression, JSDocTypeTag, JSDocTypedefTag, JSDocUnknownTag, JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxClosingFragment, JsxElement, JsxExpression, JsxFragment, JsxNamespacedName, JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, JsxSpreadAttribute, LabeledStatement, LiteralTypeNode, MappedTypeNode, MetaProperty, MethodDeclaration, MethodSignatureDeclaration, MissingDeclaration, ModuleBlock, ModuleDeclaration, NamedExports, NamedImports, NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, NonNullExpression, ObjectLiteralExpression, OptionalTypeNode, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertySignatureDeclaration, QualifiedName, RestTypeNode, ReturnStatement, SatisfiesExpression, SetAccessorDeclaration, ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, SwitchStatement, SyntheticReferenceExpression, TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateSpan, ThrowStatement, Token, TryStatement, TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, YieldExpression, propertyAssignmentPostfixToken, propertyAssignmentType, callQuestionDotToken, propertyAssignmentModifiers, callTypeArguments, } from '../ast.js';
|
|
3
3
|
import { VisitorHooks } from './visitor-hooks.js';
|
|
4
4
|
// A removed required child keeps the original, as tsgo's nil child is never printed.
|
|
5
5
|
function required(node, original) {
|
|
@@ -192,7 +192,7 @@ export class VisitorBase extends VisitorHooks {
|
|
|
192
192
|
break;
|
|
193
193
|
case 214 /* SyntaxKind.CallExpression */:
|
|
194
194
|
if (node instanceof CallExpression)
|
|
195
|
-
return this.factory.updateCallExpression(node, required(this.visitNode(node.expression), node.expression), asOptionalToken(this.visitNode(node
|
|
195
|
+
return this.factory.updateCallExpression(node, required(this.visitNode(node.expression), node.expression), asOptionalToken(this.visitNode(callQuestionDotToken(node))), this.visitNodes(callTypeArguments(node)), this.visitNodes(node.arguments), node.flags);
|
|
196
196
|
break;
|
|
197
197
|
case 180 /* SyntaxKind.CallSignature */:
|
|
198
198
|
if (node instanceof CallSignatureDeclaration)
|
|
@@ -656,7 +656,7 @@ export class VisitorBase extends VisitorHooks {
|
|
|
656
656
|
break;
|
|
657
657
|
case 303 /* SyntaxKind.PropertyAssignment */:
|
|
658
658
|
if (node instanceof PropertyAssignment)
|
|
659
|
-
return this.factory.updatePropertyAssignment(node, this.visitModifiers(node
|
|
659
|
+
return this.factory.updatePropertyAssignment(node, this.visitModifiers(propertyAssignmentModifiers(node)), required(this.visitNode(node.name), node.name), asOptionalToken(this.visitNode(propertyAssignmentPostfixToken(node))), this.visitNode(propertyAssignmentType(node)), required(this.visitNode(node.initializer), node.initializer));
|
|
660
660
|
break;
|
|
661
661
|
case 173 /* SyntaxKind.PropertyDeclaration */:
|
|
662
662
|
if (node instanceof PropertyDeclaration)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* const config = new ConfigParser(fs, '/app').parseConfigFile('/app/tsconfig.json', {}, undefined, errors);
|
|
7
7
|
* ```
|
|
8
8
|
*/
|
|
9
|
-
import { ArrayLiteralExpression, ComputedPropertyName, ExpressionStatement, ExternalModuleIndicatorOptions, getText, Identifier, NumericLiteral, ObjectLiteralExpression, ParseOptions, PrefixUnaryExpression, PropertyAssignment, StringLiteral, } from './ast.js';
|
|
9
|
+
import { ArrayLiteralExpression, ComputedPropertyName, ExpressionStatement, ExternalModuleIndicatorOptions, getText, Identifier, NumericLiteral, ObjectLiteralExpression, ParseOptions, PrefixUnaryExpression, PropertyAssignment, StringLiteral, propertyAssignmentPostfixToken, } from './ast.js';
|
|
10
10
|
import { enumNamesList } from './command-line.js';
|
|
11
11
|
import { compareCodePoints, createCompilerDiagnostic, Diagnostic, } from './diagnostics.js';
|
|
12
12
|
import { isValidLocale } from './locale.js';
|
|
@@ -767,7 +767,7 @@ class ConfigFileConverter {
|
|
|
767
767
|
this.errors.push(diagnosticAtRange(this.file, element, 102 /* Diagnostics.Property_assignment_expected */));
|
|
768
768
|
continue;
|
|
769
769
|
}
|
|
770
|
-
const postfix = element
|
|
770
|
+
const postfix = propertyAssignmentPostfixToken(element);
|
|
771
771
|
if (postfix !== undefined && postfix.kind === 57 /* SyntaxKind.QuestionToken */) {
|
|
772
772
|
this.errors.push(diagnosticAtRange(this.file, postfix, 1741 /* Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files */, '?'));
|
|
773
773
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsc-ts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "The TypeScript 7 compiler, ported to TypeScript and compiled to a native executable.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"./package.json": "./package.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@scriptc/threads": "0.4.
|
|
32
|
+
"@scriptc/threads": "0.4.2"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=20"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@tsc-ts/darwin-arm64": "0.0.
|
|
39
|
-
"@tsc-ts/darwin-x64": "0.0.
|
|
40
|
-
"@tsc-ts/linux-arm64-gnu": "0.0.
|
|
41
|
-
"@tsc-ts/linux-arm64-musl": "0.0.
|
|
42
|
-
"@tsc-ts/linux-x64-gnu": "0.0.
|
|
43
|
-
"@tsc-ts/linux-x64-musl": "0.0.
|
|
44
|
-
"@tsc-ts/win32-x64-msvc": "0.0.
|
|
38
|
+
"@tsc-ts/darwin-arm64": "0.0.8",
|
|
39
|
+
"@tsc-ts/darwin-x64": "0.0.8",
|
|
40
|
+
"@tsc-ts/linux-arm64-gnu": "0.0.8",
|
|
41
|
+
"@tsc-ts/linux-arm64-musl": "0.0.8",
|
|
42
|
+
"@tsc-ts/linux-x64-gnu": "0.0.8",
|
|
43
|
+
"@tsc-ts/linux-x64-musl": "0.0.8",
|
|
44
|
+
"@tsc-ts/win32-x64-msvc": "0.0.8"
|
|
45
45
|
}
|
|
46
46
|
}
|