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

Fix: Directly export Named type to avoid ambiguity with TS --isolatedModules option #644

Merged
merged 1 commit into from
Jun 7, 2021

Conversation

Tenga
Copy link
Contributor

@Tenga Tenga commented May 30, 2021

Description of changes:

We've recently attempted to update from 3.0.0-rc9 to 3.0.0 and encountered the following issue when using style-dictionary within our project that uses --isolatedModules via config (Next.js project, Next.js uses Babel to compile):

./node_modules/style-dictionary/types/_helpers.ts:16:10
Type error: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.

  14 | type Named<T> = T & { name: string; };
  15 |
> 16 | export { Named }

This PR makes the change of exporting the type directly inline to avoid this issue, as you are already using that syntax within styled-dictionary.

I believe the alternative means of fixing this are:

  • Having this file be a .d.ts file - Didn't want to mess with file names
  • Using export type { Named } - TS 3.8+

If necessary, context around --isolatedModules by the TS authors around this specific issue.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Tenga Tenga changed the title Directly export Named type to avoid ambiguity with TS --isolatedModules option Fix: Directly export Named type to avoid ambiguity with TS --isolatedModules option May 30, 2021
@chazzmoney
Copy link
Collaborator

Thanks for your contribution!

LGTM :shipit:

@dbanksdesign dbanksdesign merged commit 8295b0d into amzn:main Jun 7, 2021
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.

None yet

3 participants