TypeScript/tests/baselines/reference/isolatedModulesReExportType.errors.txt
Andrew Branch 8610ff5ebe
Add --preserveValueImports (#44619)
* Add compiler option

* Require es2015+

* Do not elide any imports or exports in preserve-exact

* Add errors for writing imports/exports that reference elided names

* Improve diagnostics wording

* Update API baselines

* Redo as noEraslingImportedNames

* Update option category

* Update baselines

* Lint

* Fix up transformer comments

* Fix errors from merge

* Update other error code baseline

* Rename to "preserveValueImports"

* Clean up, reword diagnostics

* Update API baselines

* Update other baseline affected by error message reword

* Update tsconfig baselines

* Add debug assertion instead of !
2021-09-08 16:30:22 -07:00

63 lines
2.5 KiB
Plaintext

/user.ts(2,10): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
/user.ts(17,10): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
/user.ts(25,10): error TS1448: 'CC' resolves to a type-only declaration and must be re-exported using a type-only re-export when 'isolatedModules' is enabled.
==== /user.ts (3 errors) ====
// Error, can't re-export something that's only a type.
export { T } from "./exportT";
~
!!! error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export import T2 = require("./exportEqualsT");
// OK, has a value side
export { C } from "./exportValue";
// OK, even though the namespace it exports is only types.
import * as NS from "./exportT";
export { NS };
// OK, syntactically clear that a type is being re-exported.
export type T3 = T;
// Error, not clear (to an isolated module) whether `T4` is a type.
import { T } from "./exportT";
export { T as T4 };
~~~~~~~
!!! error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
// Ok, type-only import indicates that the export can be elided.
import type { T as TT } from "./exportT";
export { TT };
// Error, type-only declaration is in a different file.
import { C as CC } from "./reExportValueAsTypeOnly";
export { CC };
~~
!!! error TS1448: 'CC' resolves to a type-only declaration and must be re-exported using a type-only re-export when 'isolatedModules' is enabled.
!!! related TS1377 /reExportValueAsTypeOnly.ts:1:15: 'CC' was exported here.
==== /exportT.ts (0 errors) ====
export type T = number;
==== /exportValue.ts (0 errors) ====
export class C {}
==== /exportEqualsT.ts (0 errors) ====
declare type T = number;
export = T;
==== /node_modules/foo/bar.d.ts (0 errors) ====
export type T = number;
==== /node_modules/foo/index.d.ts (0 errors) ====
export { T } from "./bar"; // In a declaration file, so not an error.
==== /node_modules/baz/index.d.ts (0 errors) ====
declare module "baz" {
export { T } from "foo"; // Also allowed.
}
==== /reExportValueAsTypeOnly.ts (0 errors) ====
export type { C } from "./exportValue";