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
whtsky opened this Issue Apr 4, 2018 · 23 comments

Comments

Projects
None yet
@whtsky
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

This comment has been minimized.

Contributor

whtsky commented Apr 4, 2018

antd version is 3.4.0
image

@KevinWang15

This comment has been minimized.

KevinWang15 commented Apr 4, 2018

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

This comment has been minimized.

Member

yesmeck commented Apr 4, 2018

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

@ant-design-bot

This comment has been minimized.

ant-design-bot commented Apr 4, 2018

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.

@KagamiChan

This comment has been minimized.

KagamiChan commented Apr 4, 2018

@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

This comment has been minimized.

Contributor

whtsky commented Apr 4, 2018

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

@narrowizard

This comment has been minimized.

narrowizard commented Apr 4, 2018

@yesmeck same error to me.

@lucasriondel

This comment has been minimized.

lucasriondel commented Apr 4, 2018

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 in 43537ed Apr 4, 2018

@kanweiwei

This comment has been minimized.

Contributor

kanweiwei commented Apr 4, 2018

happens to me too.

@alesdrobysh

This comment has been minimized.

alesdrobysh commented Apr 4, 2018

@yesmeck are you planning to issue a patch release?

@afc163

This comment has been minimized.

Member

afc163 commented Apr 4, 2018

@alesdrobysh

This comment has been minimized.

alesdrobysh commented Apr 4, 2018

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

@afc163

This comment has been minimized.

Member

afc163 commented Apr 4, 2018

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

@alesdrobysh

This comment has been minimized.

alesdrobysh commented Apr 4, 2018

@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

This comment has been minimized.

KevinWang15 commented Apr 4, 2018

@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

This comment has been minimized.

Contributor

zheeeng commented Apr 5, 2018

Happens to me.

@bora89

This comment has been minimized.

bora89 commented Apr 5, 2018

yes, the problem does exist

@pinguo-liuhongwei

This comment has been minimized.

pinguo-liuhongwei commented Apr 6, 2018

same here

@dfreire

This comment has been minimized.

dfreire commented Apr 6, 2018

It happens to me too.

@lvlohammadi

This comment has been minimized.

lvlohammadi 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

This comment has been minimized.

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

This comment has been minimized.

alesdrobysh commented Apr 7, 2018

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

zheeeng added a commit to zheeeng/ant-design that referenced this issue Apr 12, 2018

@whtsky whtsky closed this Apr 13, 2018

@Rain120

This comment has been minimized.

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