feat: support export type * and export type * as Ns re-exports (TypeScript 5.0)#360
Draft
marionebl wants to merge 1 commit into
Draft
feat: support export type * and export type * as Ns re-exports (TypeScript 5.0)#360marionebl wants to merge 1 commit into
export type * and export type * as Ns re-exports (TypeScript 5.0)#360marionebl wants to merge 1 commit into
Conversation
TypeScript 5.0 added the ability to write type-only star re-exports:
export type * from './types';
export type * as Types from './types';
These are the type-level equivalents of the existing
`export * from '…'` and `export * as Ns from '…'` forms already
handled by the JavaScript base grammar.
Add two new alternatives to the TypeScript `export_statement` override:
- `export type * <from-clause>`
- `export type <namespace_export> <from-clause>`
Add two corpus test cases in `test/corpus/declarations.txt`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TypeScript 5.0 added type-only star re-exports as the type-level counterpart to the existing
export * from '…'forms:These were previously parsed as ERROR nodes, causing downstream tools (e.g. file-scopr) to report spurious parse errors on real-world TypeScript monorepos (trpc, radix-ui, react-router, etc.).
Changes
common/define-grammar.js— two new alternatives in the TypeScriptexport_statementoverride:test/corpus/declarations.txt— two new corpus test cases:Export type starExport type star as namespaceTest results
Reference
export type *