Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Only named exports may use 'export type'. #228

Closed
FezVrasta opened this issue Mar 1, 2021 · 9 comments · Fixed by #229
Closed

Only named exports may use 'export type'. #228

FezVrasta opened this issue Mar 1, 2021 · 9 comments · Fixed by #229
Assignees
Labels
bug Something isn't working

Comments

@FezVrasta
Copy link

With 0.1.9 the following code would be converted as follows:

JS:

// @flow
export type * from './types';

TS:

export * from './types';

But with 0.2.2 I get the following:

export type * from "./types";

which results in a TS error:

lib/index.d.ts:1:1 - error TS1383: Only named exports may use 'export type'.

1 export type * from "./types";
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@aminya
Copy link
Contributor

aminya commented Mar 1, 2021

Related to microsoft/TypeScript#37238

@FezVrasta
Copy link
Author

I'm completely TypeScript noob so sorry for the question, does export * from './types' work in TS or it's only exporting JS modules that way?

@aminya
Copy link
Contributor

aminya commented Mar 1, 2021

export * from './types' exports everything including the types. Unfortunately, TypeScript doesn't support export type * now, and so export * should be used to solve this flow-to-ts issue.

@FezVrasta
Copy link
Author

I think this broken the functionality. I'm not sure what the commit is trying to achieve considering TS doesn't support it?

@aminya
Copy link
Contributor

aminya commented Mar 1, 2021

TypeScript supports all the other syntaxes. It only doesn't support export type *, which is an inconsistency from the typescript compiler.

@kevinbarabash
Copy link
Contributor

@FezVrasta yeah, I messed up with that commit. I should've converted typeof imports to kind imports. I didn't know that export type * was even a thing that flow supported. There also needs to be way more test cases for all of the different kinds of imports and exports.

@kevinbarabash
Copy link
Contributor

Please have a look at #229 and let me know if I missed any cases.

@kevinbarabash kevinbarabash self-assigned this Mar 2, 2021
@kevinbarabash kevinbarabash added the bug Something isn't working label Mar 2, 2021
@kevinbarabash
Copy link
Contributor

I've published v0.3.0 with the import/export improvements.

@FezVrasta
Copy link
Author

Works great, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants