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

type error with react 16.3.1 #9931

Closed
1 task done
whtsky opened this issue Apr 4, 2018 · 23 comments
Closed
1 task done

type error with react 16.3.1 #9931

whtsky opened this issue Apr 4, 2018 · 23 comments
Labels
🤔 Need Reproduce We cannot reproduce your problem

Comments

@whtsky
Copy link
Contributor

whtsky commented Apr 4, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.3.3

Environment

@types/react 16.3.4 , antd 3.4.0

Reproduction link

https://github.com/whtsky/antd-react-16.3.1-type

Steps to reproduce

npx tsc

What is expected?

compile

What is actually happening?

node_modules/antd/lib/badge/ScrollNumber.d.ts(28,81): error TS2344: Type '{ className: string; style: { transition: string | boolean; msTransform: string; WebkitTransform:...' does not satisfy the constraint 'HTMLAttributes'.
Types of property 'style' are incompatible.
Type '{ transition: string | boolean; msTransform: string; WebkitTransform: string; transform: string; }' is not assignable to type 'CSSProperties'.
Types of property 'transition' are incompatible.
Type 'string | boolean' is not assignable to type 'string'.
Type 'true' is not assignable to type 'string'.
node_modules/antd/lib/badge/ScrollNumber.d.ts(38,77): error TS2344: Type '{ className: string; style: { transition: string | boolean; msTransform: string; WebkitTransform:...' does not satisfy the constraint 'HTMLAttributes'.
Types of property 'style' are incompatible.
Type '{ transition: string | boolean; msTransform: string; WebkitTransform: string; transform: string; }' is not assignable to type 'CSSProperties'.
Types of property 'transition' are incompatible.
Type 'string | boolean' is not assignable to type 'string'.
Type 'true' is not assignable to type 'string'.

@whtsky
Copy link
Contributor Author

whtsky commented Apr 4, 2018

antd version is 3.4.0
image

@KevinWang15
Copy link

happens to me too.

antd: 3.4.0
react: 16.3.1
react-dom: 16.3.1
@types/react: 16.3.5
@types/react-dom: 16.0.4
typescript: 2.8.1

for the time being I edited node_modules/antd/lib/badge/ScrollNumber.d.ts
replacing all string | boolean with string

@yesmeck
Copy link
Member

yesmeck commented Apr 4, 2018

@whtsky I don't see codes in your repo.

@ant-design-bot
Copy link
Contributor

Hello @whtsky. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro. Issues labeled by Need Reproduce will be closed if no activities in 7 days.

@yesmeck yesmeck added the 🤔 Need Reproduce We cannot reproduce your problem label Apr 4, 2018
@KagamiChan
Copy link

@yesmeck It is antd's type definition (specifically, ScrollNumber.d.ts) that is incompatible with latest @types/react definition, running tsc will reproduce the issue.

IMO boolean value transition in component's style props does not make sense, so the latest @types/react is correct, and ScrollNumber.d.ts needs a fix

@whtsky
Copy link
Contributor Author

whtsky commented Apr 4, 2018

@yesmeck We don't need any code to reproduce this problem. Simply import antd will cause type error.

@narrowizard
Copy link

@yesmeck same error to me.

@lucasriondel
Copy link

same here. changing transition: string | boolean; to transition: string; in ScrollNumber.d.ts line 31&41 did it for me though, thanks @KagamiChan .

@yesmeck yesmeck closed this as completed in 43537ed Apr 4, 2018
@kanweiwei
Copy link
Contributor

happens to me too.

@alesdrobysh
Copy link

@yesmeck are you planning to issue a patch release?

@afc163
Copy link
Member

afc163 commented Apr 4, 2018

@alesdrobysh
Copy link

@afc163 isn't it urgent? it is impossible to compile TS+react+antd app

@afc163
Copy link
Member

afc163 commented Apr 4, 2018

You can try @types/react@~16.2.0 as workaround now.

@alesdrobysh
Copy link

@afc163 downgrading doesn't work if I have some @types/react-* dependencies;

for example @types/react-redux internally installs the latest react typings and it causes compilation failure

@KevinWang15
Copy link

@alesdrobysh You can try to modify node_modules/antd/lib/badge/ScrollNumber.d.ts and then use https://github.com/ds300/patch-package for now (refer to my previous comment)

@zheeeng
Copy link
Contributor

zheeeng commented Apr 5, 2018

Happens to me.

@bora89
Copy link

bora89 commented Apr 5, 2018

yes, the problem does exist

@leo-on-hill
Copy link

same here

@dfreire
Copy link

dfreire commented Apr 6, 2018

It happens to me too.

@Ramynn
Copy link

Ramynn commented Apr 7, 2018

Is this an urgent issue?
Currently i cant make any changes in node_modules, Because it's runs on the gitlab pipeline.

@bora89
Copy link

bora89 commented Apr 7, 2018

According to their schedule they ought to do a release at the end of each week, so we would rather wait a bit

@afc163 afc163 reopened this Apr 7, 2018
@alesdrobysh
Copy link

as a temporary solution it works to add skipLibCheck flag to tsconfig

dreambo8563 added a commit to dreambo8563/ts_react_mobx that referenced this issue Apr 8, 2018
@whtsky whtsky closed this as completed Apr 13, 2018
@Rain120
Copy link
Contributor

Rain120 commented Jul 11, 2018

    我理解的更新之后的版本和新版的react可能不兼容,所以你可以将版本降下去,我的版本是@AntD 3.2.0, @types/react 16.0.25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 Need Reproduce We cannot reproduce your problem
Projects
None yet
Development

No branches or pull requests