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

Typings should support attributes like "className", "id"... in index.d.ts #7532

Closed
noru opened this issue Sep 9, 2017 · 0 comments
Closed

Comments

@noru
Copy link

noru commented Sep 9, 2017

Version

2.13.0

Environment

mac os, chrome

Reproduction link

https://github.com/ant-design/ant-design/blob/master/components/slider/index.tsx

Steps to reproduce

When assigning common component props like "className" to Slider:

<Slider className="some-class" ... />

, compiler would yield :

TS2339: Property 'className' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<BasicProps, ComponentState>> & Readonly<...'.

What is expected?

By assigning props like "id" or "className", there shouldn't be any TS2339 error.

What is actually happening?

Take Slider for example but there're more components which have similar issue.

inantd/lib/slider/index.d.ts:

export interface SliderProps {
    prefixCls?: string;
    tooltipPrefixCls?: string;
    range?: boolean;
   ...
}

The props interface should either extend React.HTMLAttributes or have a [props: string]: any, cause clearly in code it supports native/custom props:

return <RcSlider {...restProps} handle={this.handleWithTooltip} />;
@afc163 afc163 closed this as completed in b216a44 Sep 9, 2017
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

No branches or pull requests

1 participant