Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: export ProviderProps from Provider component #41

Merged
merged 2 commits into from
Sep 10, 2018
Merged

types: export ProviderProps from Provider component #41

merged 2 commits into from
Sep 10, 2018

Conversation

matheus1lva
Copy link
Collaborator

Export ProviderProps type which allows users to type anything needed.

Part of ariakit/ariakit#219

exported ProviderProps to allow the usage anywhere needed (specially on
reakit)
@codecov-io
Copy link

codecov-io commented Sep 10, 2018

Codecov Report

Merging #41 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #41   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           4      4           
  Lines         115    115           
  Branches       31     31           
=====================================
  Hits          115    115
Impacted Files Coverage Δ
src/Provider.tsx 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62d4709...b9e9163. Read the comment docs.

@diegohaz
Copy link
Owner

Hey, @playma256.

I guess we need to export it in index.ts too

@matheus1lva
Copy link
Collaborator Author

Oh, yeah... i totally messed up. I saw that but my mind thought it was using export * from...

@@ -3,5 +3,6 @@ import Container from "./Container";
import Provider from "./Provider";

export * from "./types";
export * from "./Provider";
Copy link
Collaborator Author

@matheus1lva matheus1lva Sep 10, 2018

Choose a reason for hiding this comment

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

Well, i've searched and also opened a question on stackoverflow, i got a good direction on what is going wrong if we do: import {interface} from 'a' and export {interface} .

The discussion is on this Github issue: babel/babel-loader#603
and also https://stackoverflow.com/questions/52258061/export-not-found-on-module/52260432#52260432

The real problem is that "Re-exporting types is one of the known TypeScript constructs that don't work when using Babel to compile TypeScript because they require cross-file information". isolatedModules flag could be set on tsc, but that does not work generating type definitions.

Basically, there are 2 options:

export * from 'file'

import Something {interface} from 'file';
export {Something};
export type InterfaceType = interface;

There is a 3rd one, but it hacky.

I prefered the first one because it is clean. If the second one is preferable, i can change!

Copy link
Owner

@diegohaz diegohaz left a comment

Choose a reason for hiding this comment

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

Thank you, @playma256 ❤️

@diegohaz diegohaz merged commit ab132f6 into diegohaz:master Sep 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants