Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/accept-baselines-fix-lints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'

Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Use node version ${{ matrix.config.node-version }}
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: ${{ matrix.config.node-version }}
check-latest: true
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
Expand All @@ -176,7 +176,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
Expand All @@ -189,7 +189,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
Expand All @@ -202,7 +202,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
Expand All @@ -222,7 +222,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
Expand All @@ -238,7 +238,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
Expand All @@ -252,7 +252,7 @@ jobs:
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
Expand Down Expand Up @@ -300,7 +300,7 @@ jobs:
path: base
ref: ${{ github.base_ref }}

- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
Expand Down Expand Up @@ -333,7 +333,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
Expand All @@ -349,7 +349,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
Expand All @@ -370,7 +370,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# If you do not check out your code, Copilot will do this for you.
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
- run: npm ci
# pull dprint caches before network access is blocked
- run: npx hereby check-format || true
4 changes: 2 additions & 2 deletions .github/workflows/insiders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
Expand All @@ -43,7 +43,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
# Use NODE_AUTH_TOKEN environment variable to authenticate to this registry.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
ref: ${{ inputs.branch_name }}
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/new-release-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none.
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
Expand All @@ -43,7 +43,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
# Use NODE_AUTH_TOKEN environment variable to authenticate to this registry.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-branch-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/set-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
with:
ref: ${{ inputs.branch_name }}
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/twoslash-repros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none.
- if: ${{ !github.event.inputs.bisect }}
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- uses: microsoft/TypeScript-Twoslash-Repro-Action@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-package-lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 'lts/*'
- run: |
Expand Down
10 changes: 7 additions & 3 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6842,7 +6842,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return factory.createThisTypeNode();
}

if (!inTypeAlias && type.aliasSymbol && (context.flags & NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
// When generating QuickInfo, expand type aliases to show resolved types
// for better clarity in hover information
if (!inTypeAlias && type.aliasSymbol && !(context.flags & NodeBuilderFlags.InQuickInfo) && (context.flags & NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
if (!shouldExpandType(type, context, /*isAlias*/ true)) {
const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & SymbolFlags.Class)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes);
Expand Down Expand Up @@ -9028,7 +9030,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
let result;
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? symbol.declarations?.[0];
if (!canPossiblyExpandType(type, context) && decl) {
// When generating QuickInfo, prefer the resolved type over the syntactic form
// to ensure indexed access types and generic type aliases are properly resolved
if (!canPossiblyExpandType(type, context) && decl && !(context.flags & NodeBuilderFlags.InQuickInfo)) {
const restore = addSymbolTypeToContext(context, symbol, type);
if (isAccessor(decl)) {
result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
Expand Down Expand Up @@ -33858,7 +33862,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {

function checkSpreadPropOverrides(type: Type, props: SymbolTable, spread: SpreadAssignment | JsxSpreadAttribute) {
for (const right of getPropertiesOfType(type)) {
if (!(right.flags & SymbolFlags.Optional) && !(getCheckFlags(right) & CheckFlags.Partial)) {
if (!(right.flags & SymbolFlags.Optional)) {
const left = props.get(right.escapedName);
if (left) {
const diagnostic = error(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName));
Expand Down
11 changes: 5 additions & 6 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,6 @@ export const moduleOptionDeclaration: CommandLineOptionOfCustomType = {
nodenext: ModuleKind.NodeNext,
preserve: ModuleKind.Preserve,
})),
deprecatedKeys: new Set(["none", "amd", "system", "umd"]),
affectsSourceFile: true,
affectsModuleResolution: true,
affectsEmit: true,
Expand Down Expand Up @@ -700,7 +699,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
showInSimplifiedHelpView: true,
category: Diagnostics.JavaScript_Support,
description: Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJs_option_to_get_errors_from_these_files,
defaultValueDescription: Diagnostics.false_unless_checkJs_is_set,
defaultValueDescription: false,
},
{
name: "checkJs",
Expand Down Expand Up @@ -1072,13 +1071,13 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
nodenext: ModuleResolutionKind.NodeNext,
bundler: ModuleResolutionKind.Bundler,
})),
deprecatedKeys: new Set(["node", "node10", "classic"]),
deprecatedKeys: new Set(["node"]),
affectsSourceFile: true,
affectsModuleResolution: true,
paramType: Diagnostics.STRATEGY,
category: Diagnostics.Modules,
description: Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier,
defaultValueDescription: Diagnostics.nodenext_if_module_is_nodenext_node16_if_module_is_node16_or_node18_otherwise_bundler,
defaultValueDescription: Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node,
},
{
name: "baseUrl",
Expand Down Expand Up @@ -1151,7 +1150,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
affectsBuildInfo: true,
category: Diagnostics.Interop_Constraints,
description: Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
defaultValueDescription: true,
defaultValueDescription: Diagnostics.module_system_or_esModuleInterop,
},
{
name: "esModuleInterop",
Expand All @@ -1162,7 +1161,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
showInSimplifiedHelpView: true,
category: Diagnostics.Interop_Constraints,
description: Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
defaultValueDescription: true,
defaultValueDescription: false,
},
{
name: "preserveSymlinks",
Expand Down
11 changes: 5 additions & 6 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6587,7 +6587,10 @@
"category": "Message",
"code": 6903
},

"module === \"system\" or esModuleInterop": {
"category": "Message",
"code": 6904
},
"`false`, unless `strict` is set": {
"category": "Message",
"code": 6905
Expand All @@ -6608,7 +6611,7 @@
"category": "Message",
"code": 6909
},
"`nodenext` if `module` is `nodenext`; `node16` if `module` is `node16` or `node18`; otherwise, `bundler`.": {
"module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node`": {
"category": "Message",
"code": 69010
},
Expand Down Expand Up @@ -6696,10 +6699,6 @@
"category": "Error",
"code": 6931
},
"`false`, unless `checkJs` is set": {
"category": "Message",
"code": 6932
},

"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
Expand Down
27 changes: 11 additions & 16 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7505,11 +7505,7 @@ namespace Parser {
case SyntaxKind.LetKeyword:
case SyntaxKind.ConstKeyword:
case SyntaxKind.UsingKeyword:
return parseVariableStatement(pos, hasJSDoc, modifiersIn);
case SyntaxKind.AwaitKeyword:
if (!isAwaitUsingDeclaration()) {
break;
}
return parseVariableStatement(pos, hasJSDoc, modifiersIn);
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(pos, hasJSDoc, modifiersIn);
Expand Down Expand Up @@ -7538,16 +7534,17 @@ namespace Parser {
default:
return parseExportDeclaration(pos, hasJSDoc, modifiersIn);
}
default:
if (modifiersIn) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
const missing = createMissingNode<MissingDeclaration>(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
setTextRangePos(missing, pos);
(missing as Mutable<MissingDeclaration>).modifiers = modifiersIn;
return missing;
}
return undefined!; // TODO: GH#18217
}
if (modifiersIn) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
const missing = createMissingNode<MissingDeclaration>(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
setTextRangePos(missing, pos);
(missing as Mutable<MissingDeclaration>).modifiers = modifiersIn;
return missing;
}
return undefined!; // TODO: GH#18217
}

function nextTokenIsStringLiteral() {
Expand Down Expand Up @@ -7680,9 +7677,7 @@ namespace Parser {
flags |= NodeFlags.Using;
break;
case SyntaxKind.AwaitKeyword:
if (!isAwaitUsingDeclaration()) {
break;
}
Debug.assert(isAwaitUsingDeclaration());
flags |= NodeFlags.AwaitUsing;
nextToken();
break;
Expand Down
Loading
Loading