Skip to content

Commit

Permalink
Convert remaining .js files in src/ to .ts (#5044)
Browse files Browse the repository at this point in the history
* Convert src/components/index.js to .ts

- which involves adding an index.d.ts to packages for react datepicker

* Convert src/index.js to .ts

* Fix typescript errors

Credit to Greg for the original fixes

* Change index.ts to export * instead of a specific list

(in order to include/export types)

* PR feedback: Fix missing common export

* Add CHANGELOG entry

* Fix new tsc error

- I think it was caused by the common.ts export? Not totally sure why it only just started happening

- PR is slowly just becoming Greg's old PR over time ha

* Create new script enforcing `npm pack` over `yarn pack`

- Per Greg's eagle eyes, `yarn pack` was failing to bundle/include the `src/test/` folder somehow and causing test failures for plugins in Kibana trying to import `lib/test/` helpers

- `npm pack` doesn't have this issue, so I opted to create a new command that enforces npm pack over yarn pack
  • Loading branch information
Constance authored Aug 19, 2021
1 parent 0a9857d commit 5cde110
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 357 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Updated `EuiFlyout` testenv mock to pass-through `onKeyDown` prop ([#5029](https://github.com/elastic/eui/pull/5029))
- Enabled `EuiCodeBlock` copy button in `EuiMarkdownFormat` ([#5032](https://github.com/elastic/eui/pull/5032))
- Changed `copy` icon to `copyClipboard` in `EuiCodeBlock` ([#5018](https://github.com/elastic/eui/pull/5018))
- Finished type conversion of source components to Typescript ([#5044](https://github.com/elastic/eui/pull/5044))

**Bug fixes**

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"sync-docs": "node ./scripts/docs-sync.js",
"build-docs": "cross-env BABEL_MODULES=false cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=4096 webpack --config=src-docs/webpack.config.js",
"build": "yarn extract-i18n-strings && node ./scripts/compile-clean.js && node ./scripts/compile-eui.js && node ./scripts/compile-scss.js $npm_package_name",
"build-pack": "yarn build && npm pack",
"compile-icons": "node ./scripts/compile-icons.js && prettier --write --loglevel=warn \"./src/components/icon/assets/**/*.js\"",
"extract-i18n-strings": "node ./scripts/babel/fetch-i18n-strings",
"lint": "yarn tsc --noEmit && yarn lint-es && yarn lint-sass",
Expand Down
2 changes: 0 additions & 2 deletions src/components/index.d.ts → packages/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
*/

declare module '@elastic/eui' {
// @ts-ignore path only exists at build time
export * from '@elastic/eui/src/components/common'; // eslint-disable-line import/no-unresolved
// @ts-ignore path only exists at build time
export * from '@elastic/eui/src/components/date_picker/react-datepicker'; // eslint-disable-line import/no-unresolved
}
2 changes: 1 addition & 1 deletion src/components/color_picker/color_stops/color_stops.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
removeStop,
} from './utils';

import { EuiColorPickerProps } from '../';
import { EuiColorPickerProps } from '../color_picker';
import { getChromaColor } from '../utils';
import { EuiI18n } from '../../i18n';
import { EuiScreenReaderOnly } from '../../accessibility';
Expand Down
333 changes: 0 additions & 333 deletions src/components/index.js

This file was deleted.

Loading

0 comments on commit 5cde110

Please sign in to comment.