Skip to content

Commit

Permalink
fix: regression in v2.0.3 on TypeScript <= 3.7 where ExportDeclaratio…
Browse files Browse the repository at this point in the history
…ns could be dropped
  • Loading branch information
wessberg committed Nov 19, 2021
1 parent 78bb9a1 commit f56c91c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -34,6 +34,8 @@ One of the most powerful features of `rollup-plugin-ts` is declaration bundling

Tooling in the JavaScript ecosystem can often be complex, and this is very much the case when intending to combine TypeScript with other tools such as Babel and Browserslists while still maintaining the [unique emit capabilities of `tsc`](https://github.com/rollup/rollup-plugin-typescript/issues/28). `rollup-plugin-ts` differs from other TypeScript plugins in being opiniated about how some of these tools integrate in order to achieve the most optimal behavior with the smallest possible computational overhead. For example, when combined with another transpiler such as Babel, TypeScript handles diagnostics, declarations, and stripping away types, while Babel is used for syntax transformations.

At the same time, `rollup-plugin-ts` has a very robust test suite that runs tests across all minor versions of TypeScript since v3.4 to ensure that everything works no matter which version of TypeScript you or your team is using.

<!-- SHADOW_SECTION_FEATURES_START -->

### Features
Expand All @@ -47,6 +49,7 @@ Tooling in the JavaScript ecosystem can often be complex, and this is very much
- Correctly handles [Emit-less types](https://github.com/rollup/rollup-plugin-typescript/issues/28)
- Supports Incremental compilation.
- A [Browserslist](https://github.com/browserslist/browserslist) can be provided instead of a target version of ECMAScript such that your code is transpiled in relation to the baseline of browsers defined in your Browserslist instead.
- Robust, with a comprehensive test suite that runs against all minor versions of TypeScript from v3.4 and up.

<!-- SHADOW_SECTION_FEATURE_IMAGE_START -->

Expand Down
Expand Up @@ -62,7 +62,7 @@ export function getMergedExportDeclarationsForModules(options: GetMergedExportDe
}

for (const exportDeclaration of exports) {
if (exportDeclaration.isTypeOnly !== isTypeOnly) continue;
if (Boolean(exportDeclaration.isTypeOnly) !== Boolean(isTypeOnly)) continue;

// If the ModuleSpecifier is given and it isn't a string literal, leave it as it is
if (exportDeclaration.moduleSpecifier != null && !typescript.isStringLiteralLike(exportDeclaration.moduleSpecifier)) {
Expand Down
1 change: 1 addition & 0 deletions test/type-reference-directive.test.ts
Expand Up @@ -28,6 +28,7 @@ test.serial("Detects type reference directives and respects tree-shaking and cod
const {
declarations: [file]
} = bundle;

t.deepEqual(
formatCode(file.code),
formatCode(`\
Expand Down

0 comments on commit f56c91c

Please sign in to comment.