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

Add missing TS defs and fixing existing def #1240

Merged
merged 5 commits into from
Oct 15, 2018

Conversation

pugnascotia
Copy link
Contributor

Add TypeScript definitions for EuiFormLabel and EuiSelect, and fix the EuiTextColor definition.

I skipped the checklist for this PR as this is purely a TS definition change, and has no functional or visual change. I tested the changes during work on migrating a project to TS, which is how I discovered the issue.

Add TypeScript definitions for:
- `EuiFormLabel`
- `EuiSelect`

Fix the `EuiTextColor` definition.
@pugnascotia
Copy link
Contributor Author

I've added a definition for EuiFieldNumber too.

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.

Couple of small changes

* @see './field_number.js'
*/
export interface EuiFieldNumberProps {
icon?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

should be IconType imported from EuiIcon's index.d.ts

*/

export type EuiFormLabelProps = CommonProps &
HTMLAttributes<HTMLLabelElement> & {
Copy link
Contributor

Choose a reason for hiding this comment

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

LabelHTMLAttributes instead of HTMLAttributes, LabelHTMLAttributes<HTMLLabelElement>

*/

export type EuiSelectProps = CommonProps &
OptionHTMLAttributes<HTMLSelectElement> & {
Copy link
Contributor

Choose a reason for hiding this comment

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

SelectHTMLAttributes instead of OptionHTMLAttributes

/// <reference path="../../common.d.ts" />

import { ReactNode, SFC, InputHTMLAttributes } from 'react';
import { IconType } from '@elastic/eui'
Copy link
Contributor

Choose a reason for hiding this comment

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

Our approach for these is adding a reference to the icon file, e.g. /// <reference path="../icon/index.d.ts" />

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.

changes LGTM!

@pugnascotia pugnascotia merged commit bf3295a into elastic:master Oct 15, 2018
@pugnascotia pugnascotia deleted the fix-typescript-defs branch October 15, 2018 16:22
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.

2 participants