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

Export missing type definitions #2434

Merged
merged 5 commits into from
Oct 15, 2019
Merged

Conversation

thompsongl
Copy link
Contributor

@thompsongl thompsongl commented Oct 15, 2019

Summary

Exports formerly exported types:

  • ButtonSize
  • ButtonIconSide
  • EmptyButtonColor (now EuiEmptyButtonColor) [now EuiButtonEmptyColor]
  • EmptyButtonSizes (now EuiEmptyButtonSizes) [now EuiButtonEmptySizes ]
  • ButtonIconColor (now EuiButtonIconColor)
  • EuiLinkColor
  • EuiLinkType

Checklist

- [ ] Checked in dark mode
- [ ] Checked in mobile
- [ ] Checked in IE11 and Firefox
- [ ] Props have proper autodocs
- [ ] Added documentation examples
- [ ] Added or updated jest tests
- [ ] Checked for breaking changes and labeled appropriately
- [ ] Checked for accessibility including keyboard-only and screenreader modes

  • A changelog entry exists and is marked appropriately

@bevacqua
Copy link
Contributor

In Cloud UI linter is also complaining about ButtonIconSide, EmptyButtonSizes, and ButtonIconColor

@chandlerprall
Copy link
Contributor

Tested with yarn build and received the error

eui.d.ts:3129:35 - error TS2307: Cannot find module '@elastic/eui/src/components/button'.
3129  export const ICON_SIDES: import ("@elastic/eui/src/components/button").ButtonIconSide[];

line 3129 is

export const ICON_SIDES: import ("@elastic/eui/src/components/button").ButtonIconSide[];

from

declare module '@elastic/eui/src/components/badge/badge' {

I'm looking into this further.

@thompsongl
Copy link
Contributor Author

This rings a bell. The d.ts generator attempts to reuse types if they are identical (or something like that)

@chandlerprall
Copy link
Contributor

The d.ts generator attempts to reuse types if they are identical (or something like that)

You appear to be correct. I don't know what layer (TypeScript or dts-generator) does that, but yep. What's happening is it tries to re-use ButtonIconSide from button/index.ts but we custom-map the index.ts files to the @elastic/eui module. Working on a fix.

@chandlerprall
Copy link
Contributor

Pushed a fix for the eui.d.ts error, confirmed that it only changed the one line

13:34 $ diff eui.d.ts eui.d.ts.new
3129c3129
< 	export const ICON_SIDES: import ("@elastic/eui/src/components/button").ButtonIconSide[];
---
> 	export const ICON_SIDES: import ("@elastic/eui").ButtonIconSide[];

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

Built eui.d.ts from this PR and pulled it into an empty TypeScript project. I confirmed the ability to import the added/corrected types.

import {
    ButtonSize,
    ButtonIconSide,
    EuiButtonEmptyColor,
    EuiButtonEmptySizes,
    EuiButtonIconColor,
    EuiLinkColor,
    EuiLinkType,
} from '@elastic/eui';

@thompsongl thompsongl merged commit 307e640 into elastic:master Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants