Skip to content

Commit ee429dd

Browse files
committed
Merge branch 'main' into fix53563
2 parents 8abf6e5 + a1df8f7 commit ee429dd

File tree

2,318 files changed

+236980
-145085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,318 files changed

+236980
-145085
lines changed

.github/pr_owners.txt

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ gabritto
1212
jakebailey
1313
DanielRosenwasser
1414
navya9singh
15+
iisaduan

.github/workflows/new-release-branch.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
git add src/compiler/corePublic.ts
3838
git add tests/baselines/reference/api/typescript.d.ts
3939
git add tests/baselines/reference/api/tsserverlibrary.d.ts
40-
git add ./lib
40+
git add --force ./lib
4141
git config user.email "[email protected]"
4242
git config user.name "TypeScript Bot"
4343
git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG'

.github/workflows/set-version.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
git add src/compiler/corePublic.ts
4444
git add tests/baselines/reference/api/typescript.d.ts
4545
git add tests/baselines/reference/api/tsserverlibrary.d.ts
46-
git add ./lib
46+
git add --force ./lib
4747
git config user.email "[email protected]"
4848
git config user.name "TypeScript Bot"
4949
git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG'

.github/workflows/update-lkg.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
npx hereby LKG
2626
npm test
2727
git diff
28-
git add ./lib
28+
git add --force ./lib
2929
git commit -m "Update LKG"
3030
git push

Herebyfile.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
171171
bundle: true,
172172
outfile,
173173
platform: "node",
174-
target: "es2018",
174+
target: ["es2020", "node14.17"],
175175
format: "cjs",
176176
sourcemap: "linked",
177177
sourcesContent: false,

package-lock.json

+363-354
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"tsserver": "./bin/tsserver"
2727
},
2828
"engines": {
29-
"node": ">=12.20"
29+
"node": ">=14.17"
3030
},
3131
"files": [
3232
"bin",
@@ -83,7 +83,9 @@
8383
"which": "^2.0.2"
8484
},
8585
"overrides": {
86-
"typescript@*": "$typescript"
86+
"typescript@*": "$typescript",
87+
"@octokit/types": "9.0.0",
88+
"@octokit/openapi-types": "16.0.0"
8789
},
8890
"scripts": {
8991
"test": "hereby runtests-parallel --light=false",

src/compiler/binder.ts

+5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import {
8989
getEnclosingBlockScopeContainer,
9090
getErrorSpanForNode,
9191
getEscapedTextOfIdentifierOrLiteral,
92+
getEscapedTextOfJsxNamespacedName,
9293
getExpandoInitializer,
9394
getHostSignatureFromJSDoc,
9495
getImmediatelyInvokedFunctionExpression,
@@ -171,6 +172,7 @@ import {
171172
isJSDocTemplateTag,
172173
isJSDocTypeAlias,
173174
isJsonSourceFile,
175+
isJsxNamespacedName,
174176
isLeftHandSideExpression,
175177
isLogicalOrCoalescingAssignmentExpression,
176178
isLogicalOrCoalescingAssignmentOperator,
@@ -679,6 +681,9 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
679681
const containingClassSymbol = containingClass.symbol;
680682
return getSymbolNameForPrivateIdentifier(containingClassSymbol, name.escapedText);
681683
}
684+
if (isJsxNamespacedName(name)) {
685+
return getEscapedTextOfJsxNamespacedName(name);
686+
}
682687
return isPropertyNameLiteral(name) ? getEscapedTextOfIdentifierOrLiteral(name) : undefined;
683688
}
684689
switch (node.kind) {

src/compiler/checker.ts

+246-116
Large diffs are not rendered by default.

src/compiler/diagnosticMessages.json

+16
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,10 @@
16051605
"category": "Error",
16061606
"code": 1489
16071607
},
1608+
"File appears to be binary.": {
1609+
"category": "Error",
1610+
"code": 1490
1611+
},
16081612

16091613
"The types of '{0}' are incompatible between these types.": {
16101614
"category": "Error",
@@ -2889,6 +2893,10 @@
28892893
"category": "Error",
28902894
"code": 2638
28912895
},
2896+
"React components cannot include JSX namespace names": {
2897+
"category": "Error",
2898+
"code": 2639
2899+
},
28922900

28932901
"Cannot augment module '{0}' with value exports because it resolves to a non-module entity.": {
28942902
"category": "Error",
@@ -7592,6 +7600,10 @@
75927600
"category": "Message",
75937601
"code": 95177
75947602
},
7603+
"Move to file": {
7604+
"category": "Message",
7605+
"code": 95178
7606+
},
75957607

75967608
"No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer.": {
75977609
"category": "Error",
@@ -7756,5 +7768,9 @@
77567768
"Non-abstract class '{0}' does not implement all abstract members of '{1}'": {
77577769
"category": "Error",
77587770
"code": 18052
7771+
},
7772+
"Its type '{0}' is not a valid JSX element type.": {
7773+
"category": "Error",
7774+
"code": 18053
77597775
}
77607776
}

src/compiler/emitter.ts

+14-6
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ import {
289289
JsxEmit,
290290
JsxExpression,
291291
JsxFragment,
292+
JsxNamespacedName,
292293
JsxOpeningElement,
293294
JsxOpeningFragment,
294295
JsxSelfClosingElement,
@@ -1154,6 +1155,7 @@ export const notImplementedResolver: EmitResolver = {
11541155
// Returns the constant value this property access resolves to: notImplemented, or 'undefined' for a non-constant
11551156
getConstantValue: notImplemented,
11561157
getReferencedValueDeclaration: notImplemented,
1158+
getReferencedValueDeclarations: notImplemented,
11571159
getTypeReferenceSerializationKind: notImplemented,
11581160
isOptionalParameter: notImplemented,
11591161
moduleExportsSomeValue: notImplemented,
@@ -2177,8 +2179,6 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
21772179

21782180
// Transformation nodes
21792181
case SyntaxKind.NotEmittedStatement:
2180-
case SyntaxKind.EndOfDeclarationMarker:
2181-
case SyntaxKind.MergeDeclarationMarker:
21822182
return;
21832183
}
21842184
if (isExpression(node)) {
@@ -2283,6 +2283,8 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
22832283
return emitJsxSelfClosingElement(node as JsxSelfClosingElement);
22842284
case SyntaxKind.JsxFragment:
22852285
return emitJsxFragment(node as JsxFragment);
2286+
case SyntaxKind.JsxNamespacedName:
2287+
return emitJsxNamespacedName(node as JsxNamespacedName);
22862288

22872289
// Synthesized list
22882290
case SyntaxKind.SyntaxList:
@@ -2295,9 +2297,6 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
22952297
return emitPartiallyEmittedExpression(node as PartiallyEmittedExpression);
22962298
case SyntaxKind.CommaListExpression:
22972299
return emitCommaList(node as CommaListExpression);
2298-
case SyntaxKind.MergeDeclarationMarker:
2299-
case SyntaxKind.EndOfDeclarationMarker:
2300-
return;
23012300
case SyntaxKind.SyntheticReferenceExpression:
23022301
return Debug.fail("SyntheticReferenceExpression should not be printed");
23032302
}
@@ -4225,6 +4224,12 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
42254224
}
42264225
}
42274226

4227+
function emitJsxNamespacedName(node: JsxNamespacedName) {
4228+
emitIdentifierName(node.namespace);
4229+
writePunctuation(":");
4230+
emitIdentifierName(node.name);
4231+
}
4232+
42284233
function emitJsxTagName(node: JsxTagNameExpression) {
42294234
if (node.kind === SyntaxKind.Identifier) {
42304235
emitExpression(node);
@@ -4866,7 +4871,10 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
48664871
}
48674872

48684873
function emitEmbeddedStatement(parent: Node, node: Statement) {
4869-
if (isBlock(node) || getEmitFlags(parent) & EmitFlags.SingleLine) {
4874+
if (isBlock(node) ||
4875+
getEmitFlags(parent) & EmitFlags.SingleLine ||
4876+
preserveSourceNewlines && !getLeadingLineTerminatorCount(parent, node, ListFormat.None)
4877+
) {
48704878
writeSpace();
48714879
emit(node);
48724880
}

src/compiler/factory/nodeFactory.ts

+35-37
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ import {
7979
EmitNode,
8080
emptyArray,
8181
EmptyStatement,
82-
EndOfDeclarationMarker,
8382
EndOfFileToken,
8483
EntityName,
8584
EnumDeclaration,
@@ -121,6 +120,7 @@ import {
121120
getLineAndCharacterOfPosition,
122121
getNameOfDeclaration,
123122
getNodeId,
123+
getNonAssignedNameOfDeclaration,
124124
getSourceMapRange,
125125
getSyntheticLeadingComments,
126126
getSyntheticTrailingComments,
@@ -267,6 +267,7 @@ import {
267267
JSDocVariadicType,
268268
JsxAttribute,
269269
JsxAttributeLike,
270+
JsxAttributeName,
270271
JsxAttributes,
271272
JsxAttributeValue,
272273
JsxChild,
@@ -275,6 +276,7 @@ import {
275276
JsxElement,
276277
JsxExpression,
277278
JsxFragment,
279+
JsxNamespacedName,
278280
JsxOpeningElement,
279281
JsxOpeningFragment,
280282
JsxSelfClosingElement,
@@ -296,7 +298,6 @@ import {
296298
MemberName,
297299
memoize,
298300
memoizeOne,
299-
MergeDeclarationMarker,
300301
MetaProperty,
301302
MethodDeclaration,
302303
MethodSignature,
@@ -908,6 +909,8 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
908909
updateJsxSpreadAttribute,
909910
createJsxExpression,
910911
updateJsxExpression,
912+
createJsxNamespacedName,
913+
updateJsxNamespacedName,
911914
createCaseClause,
912915
updateCaseClause,
913916
createDefaultClause,
@@ -942,8 +945,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
942945
updatePartiallyEmittedExpression,
943946
createCommaListExpression,
944947
updateCommaListExpression,
945-
createEndOfDeclarationMarker,
946-
createMergeDeclarationMarker,
947948
createSyntheticReferenceExpression,
948949
updateSyntheticReferenceExpression,
949950
cloneNode,
@@ -1105,7 +1106,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
11051106
function createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral {
11061107
const node = createBaseToken<BigIntLiteral>(SyntaxKind.BigIntLiteral);
11071108
node.text = typeof value === "string" ? value : pseudoBigIntToString(value) + "n";
1108-
node.transformFlags |= TransformFlags.ContainsESNext;
1109+
node.transformFlags |= TransformFlags.ContainsES2020;
11091110
return node;
11101111
}
11111112

@@ -3675,7 +3676,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
36753676
node.transformFlags |= TransformFlags.ContainsES2015;
36763677
break;
36773678
case SyntaxKind.ImportKeyword:
3678-
node.transformFlags |= TransformFlags.ContainsESNext;
3679+
node.transformFlags |= TransformFlags.ContainsES2020;
36793680
break;
36803681
default:
36813682
return Debug.assertNever(keywordToken);
@@ -4715,7 +4716,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
47154716
node.name = name;
47164717
node.transformFlags |=
47174718
propagateChildFlags(node.name) |
4718-
TransformFlags.ContainsESNext;
4719+
TransformFlags.ContainsES2020;
47194720
node.transformFlags &= ~TransformFlags.ContainsPossibleTopLevelAwait; // always parsed in an Await context
47204721
return node;
47214722
}
@@ -5582,7 +5583,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
55825583
}
55835584

55845585
// @api
5585-
function createJsxAttribute(name: Identifier, initializer: JsxAttributeValue | undefined) {
5586+
function createJsxAttribute(name: JsxAttributeName, initializer: JsxAttributeValue | undefined) {
55865587
const node = createBaseDeclaration<JsxAttribute>(SyntaxKind.JsxAttribute);
55875588
node.name = name;
55885589
node.initializer = initializer;
@@ -5594,7 +5595,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
55945595
}
55955596

55965597
// @api
5597-
function updateJsxAttribute(node: JsxAttribute, name: Identifier, initializer: JsxAttributeValue | undefined) {
5598+
function updateJsxAttribute(node: JsxAttribute, name: JsxAttributeName, initializer: JsxAttributeValue | undefined) {
55985599
return node.name !== name
55995600
|| node.initializer !== initializer
56005601
? update(createJsxAttribute(name, initializer), node)
@@ -5654,6 +5655,26 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
56545655
: node;
56555656
}
56565657

5658+
// @api
5659+
function createJsxNamespacedName(namespace: Identifier, name: Identifier) {
5660+
const node = createBaseNode<JsxNamespacedName>(SyntaxKind.JsxNamespacedName);
5661+
node.namespace = namespace;
5662+
node.name = name;
5663+
node.transformFlags |=
5664+
propagateChildFlags(node.namespace) |
5665+
propagateChildFlags(node.name) |
5666+
TransformFlags.ContainsJsx;
5667+
return node;
5668+
}
5669+
5670+
// @api
5671+
function updateJsxNamespacedName(node: JsxNamespacedName, namespace: Identifier, name: Identifier) {
5672+
return node.namespace !== namespace
5673+
|| node.name !== name
5674+
? update(createJsxNamespacedName(namespace, name), node)
5675+
: node;
5676+
}
5677+
56575678
//
56585679
// Clauses
56595680
//
@@ -6186,30 +6207,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
61866207
: node;
61876208
}
61886209

6189-
/**
6190-
* Creates a synthetic element to act as a placeholder for the end of an emitted declaration in
6191-
* order to properly emit exports.
6192-
*/
6193-
// @api
6194-
function createEndOfDeclarationMarker(original: Node) {
6195-
const node = createBaseNode<EndOfDeclarationMarker>(SyntaxKind.EndOfDeclarationMarker);
6196-
node.emitNode = {} as EmitNode;
6197-
node.original = original;
6198-
return node;
6199-
}
6200-
6201-
/**
6202-
* Creates a synthetic element to act as a placeholder for the beginning of a merged declaration in
6203-
* order to properly emit exports.
6204-
*/
6205-
// @api
6206-
function createMergeDeclarationMarker(original: Node) {
6207-
const node = createBaseNode<MergeDeclarationMarker>(SyntaxKind.MergeDeclarationMarker);
6208-
node.emitNode = {} as EmitNode;
6209-
node.original = original;
6210-
return node;
6211-
}
6212-
62136210
// @api
62146211
function createSyntheticReferenceExpression(expression: Expression, thisArg: Expression) {
62156212
const node = createBaseNode<SyntheticReferenceExpression>(SyntaxKind.SyntheticReferenceExpression);
@@ -6648,8 +6645,8 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
66486645
: reduceLeft(expressions, factory.createComma)!;
66496646
}
66506647

6651-
function getName(node: Declaration | undefined, allowComments?: boolean, allowSourceMaps?: boolean, emitFlags: EmitFlags = 0) {
6652-
const nodeName = getNameOfDeclaration(node);
6648+
function getName(node: Declaration | undefined, allowComments?: boolean, allowSourceMaps?: boolean, emitFlags: EmitFlags = 0, ignoreAssignedName?: boolean) {
6649+
const nodeName = ignoreAssignedName ? node && getNonAssignedNameOfDeclaration(node) : getNameOfDeclaration(node);
66536650
if (nodeName && isIdentifier(nodeName) && !isGeneratedIdentifier(nodeName)) {
66546651
// TODO(rbuckton): Does this need to be parented?
66556652
const name = setParent(setTextRange(cloneNode(nodeName), nodeName), nodeName.parent);
@@ -6686,9 +6683,10 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
66866683
* @param node The declaration.
66876684
* @param allowComments A value indicating whether comments may be emitted for the name.
66886685
* @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
6686+
* @param ignoreAssignedName Indicates that the assigned name of a declaration shouldn't be considered.
66896687
*/
6690-
function getLocalName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean) {
6691-
return getName(node, allowComments, allowSourceMaps, EmitFlags.LocalName);
6688+
function getLocalName(node: Declaration, allowComments?: boolean, allowSourceMaps?: boolean, ignoreAssignedName?: boolean) {
6689+
return getName(node, allowComments, allowSourceMaps, EmitFlags.LocalName, ignoreAssignedName);
66926690
}
66936691

66946692
/**

0 commit comments

Comments
 (0)