Skip to content

Fix completions at type-only export specifiers#62651

Closed
Andarist wants to merge 1 commit intomicrosoft:mainfrom
Andarist:fix/completions-export-type
Closed

Fix completions at type-only export specifiers#62651
Andarist wants to merge 1 commit intomicrosoft:mainfrom
Andarist:fix/completions-export-type

Conversation

@Andarist
Copy link
Copy Markdown
Contributor

@Andarist Andarist commented Oct 21, 2025

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Oct 21, 2025
@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 21, 2025
@typescript-bot
Copy link
Copy Markdown
Collaborator

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

////
//// export { M/*6*/ } from "./m1"
//// export type { M/*7*/ } from "./m1"
//// export { type M/*8*/ } from "./m1"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing this is the main goal of this PR. At the moment, on the main branch this errors with:

Error: At marker '8': No completions at position '232'

// import { type foo| }
return containingNodeKind !== SyntaxKind.ImportSpecifier;
// export { type foo| }
return !isImportOrExportSpecifier(parent);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only change needed to accomplish the goal of this PR. I threw in the rest of the changes to fix some redundant type keyword completions (all of that is reflected by the tests I added)

case SyntaxKind.ExportSpecifier:
return (node as ExportSpecifier).isTypeOnly || (node as ExportSpecifier).parent.parent.isTypeOnly;
case SyntaxKind.ExportDeclaration:
return (node as ExportDeclaration).isTypeOnly && !!(node as ExportDeclaration).moduleSpecifier && !(node as ExportDeclaration).exportClause;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those extra requirements were quite odd here (and got in a way of the tests I was adding for type keyword inclusion/exclusion). An export declaration should be treated as type-only regardless of the existence of other fields on that export declaration AST node. The introduced change also matches the import-oriented counterpart of the containing function (isTypeOnlyImportDeclaration) where there are no extra conditions in the SyntaxKind.ImportSpecifier case.

@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Mar 24, 2026
@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants