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

rewrite in typescript #1846

Closed
47 tasks done
yiminghe opened this issue May 25, 2016 · 47 comments · Fixed by #2838
Closed
47 tasks done

rewrite in typescript #1846

yiminghe opened this issue May 25, 2016 · 47 comments · Fixed by #2838

Comments

@yiminghe
Copy link
Contributor

yiminghe commented May 25, 2016

@ALL

https://www.typescriptlang.org/docs/handbook/basic-types.html

demo: https://github.com/ant-design/ant-design/blob/master/components/affix/index.tsx
recommended IDE: visual studio code / idea

steps

env

npm i typings -g
typings install

move types in index.d.ts to components/xx/index.tsx

change react import

import React from 'react';
import ReactDOM from 'react-dom';

to

import * as React from 'react';
import * as ReactDOM from 'react-dom';

add reference to components/index.tsx

import Xx from './xx';
export { Xx };

npm run ts-lint

delete index.d.ts

change index.js to

module.export = require('./src/');
console.warn('you are ....')

components

  • --------- @afc163 ---------
  • affix
  • alert
  • badge
  • breadcrumb
  • button
  • card
  • --------- @benjycui ---------
  • calendar
  • --------- @RaoHai ---------
  • checkbox
  • collapse
  • dropdown
  • form
  • --------- @benjycui ---------
  • date-picker
  • icon
  • input
  • input-number
  • layout
  • --------- @ddcat1115 ---------
  • locale-provider
  • menu
  • message
  • modal
  • notification
  • pagination
  • popconfirm
  • popover
  • progress
  • radio
  • --------- @benjycui ---------
  • rate
  • select
  • slider
  • spin
  • steps
  • switch
  • table
  • --------- @BANG88 ---------
  • tabs
  • tag
  • time-picker
  • timeline
  • tooltip
  • --------- @GrayChoi ---------
  • transfer
  • tree
  • carousel
  • cascader
  • --------- @afc163 ---------
  • tree-select
  • upload

  • Make sure no tsc errors (Add tsc into npm run lint)
  • delete index.d.ts
  • change index.js to ...

This will close #973

@waywardmonkeys
Copy link
Contributor

Is this going to happen? (I think it would be great!)

@yiminghe
Copy link
Contributor Author

affix ok

@afc163
Copy link
Member

afc163 commented Jun 22, 2016

Add https://github.com/buzinas/tslint-eslint-rules for missing eslint rules like object-curly-spacing

@BANG88
Copy link
Member

BANG88 commented Jun 23, 2016

Maybe i can do something about this topic. but don't know your plan yet.

@yiminghe
Copy link
Contributor Author

@BANG88 move types in index.d.ts to components , see affix, welcome pr

@afc163
Copy link
Member

afc163 commented Jun 23, 2016

Assigned and updated

@afc163
Copy link
Member

afc163 commented Jun 23, 2016

@BANG88 @waywardmonkeys Maybe you guys can help to rewrite some components which are assigned to you above. (If you want to 🎅 )

@BANG88
Copy link
Member

BANG88 commented Jun 23, 2016

@afc163 OK.can we have a develop instruction? how to rewrite it using ts,and how to test it.
By the way, npm start failed on windows.

@afc163
Copy link
Member

afc163 commented Jun 23, 2016

Develop instruction: https://github.com/ant-design/ant-design/wiki/Development#local-development

And rewrite instruction in top floor: #1846 (comment)

We don't support developing in windows right now. 😢 You could help us improve that too.

@BANG88
Copy link
Member

BANG88 commented Jun 23, 2016

@afc163 @yiminghe

I add some typings for Tabs.but not sure this is ok ?.can you have a look... Thanks
https://github.com/bang88/ant-design/commit/72965da807516c69c65a3a53379c96cc661aab27

@RaoHai
Copy link
Contributor

RaoHai commented Jun 24, 2016

3c4dec2

是这样改的么?总感觉哪里不对的样子

@yiminghe
Copy link
Contributor Author

after modification, use vs code to open project and check

@GrayChoi
Copy link
Contributor

我也可以帮忙用typescript重写一部分组件,如果需要的话。

@dyf2015
Copy link

dyf2015 commented Jun 26, 2016

??ts?????????

???? iPhone

? 2016?6?26??13:07?Gray Choi <notifications@github.commailto:notifications@github.com> ???

???????typescript???????????????

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/1846#issuecomment-228584616, or mute the threadhttps://github.com/notifications/unsubscribe/APjvyTFgIjFcdvL6RkLzPbZdXuF5tj7pks5qPgkYgaJpZM4ImUZY.

@maolion
Copy link

maolion commented Jun 29, 2016

赞!

@maolion
Copy link

maolion commented Jun 29, 2016

我也可以帮忙,如果有需要的话。

@afc163
Copy link
Member

afc163 commented Jun 29, 2016

@GrayChoi @maolion Assigned some component to you, Thx!

@maolion
Copy link

maolion commented Jun 29, 2016

@afc163 看到了,最近很少关注antd的动态。

@infeng
Copy link
Contributor

infeng commented Jun 29, 2016

i use typescript a long time, i can help

@xuyang2
Copy link

xuyang2 commented Jul 1, 2016

我也可以帮忙用 TypeScript 改写一部分组件,如果需要的话。

@GrayChoi GrayChoi mentioned this issue Jul 1, 2016
8 tasks
@benjycui
Copy link
Contributor

benjycui commented Jul 4, 2016

看来大家都是对写代码感兴趣,不喜欢写文档 😂

@afc163 afc163 mentioned this issue Jul 5, 2016
19 tasks
@yeliex
Copy link
Contributor

yeliex commented Jul 9, 2016

@benjycui 我可以帮忙更新文档 如果需要的话

@benjycui
Copy link
Contributor

benjycui commented Jul 9, 2016

@yeliex THX, and see: #1471

afc163 added a commit that referenced this issue Jul 12, 2016
@benjycui
Copy link
Contributor

@wenxiongid if you have no time, I am going to finish your tasks, OK?

@wenxiongid
Copy link

@benjycui OK, sorry for my busy job these days

@plandem
Copy link
Contributor

plandem commented Aug 15, 2016

omg...looks like it's going to happen :)

@benjycui
Copy link
Contributor

Jobs done ! @afc163 @benjycui @RaoHai @ddcat1115 @BANG88 @GrayChoi

But, there still leave a lot to be improved. 😄

@afc163
Copy link
Member

afc163 commented Aug 20, 2016

Updated.

@afc163 afc163 reopened this Aug 20, 2016
@benjycui
Copy link
Contributor

Make sure no tsc errors (Add tsc into npm run lint)

WIP

@benjycui
Copy link
Contributor

change index.js to ...

@afc163 ??

@afc163
Copy link
Member

afc163 commented Aug 25, 2016

Look at #1846 (comment)

@ziaochina
Copy link

很想知道为啥要换TypeScript呢?

@afc163
Copy link
Member

afc163 commented Sep 28, 2016

@ziaochina #973

@ziaochina
Copy link

@afc163 除了#973,有微软方面的原因吗?

@AlbertZheng
Copy link
Contributor

AlbertZheng commented Oct 10, 2016

When migrated from antd 1.11.x to 2.0.1, there are many errors reported by tsc 1.8.10 and 2.0.3 as the following. Please have a check:

A workaround for TS7006 is to manually add any or any[] type declaration for those parameter in the reported d.ts files. But this error "TS2307: Cannot find module 'rc-select'" perhaps will need to write a index.d.ts for rc-select component.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/upload/interface.d.ts
(30,23): error TS7006: Parameter 'File' implicitly has an 'any' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/select/index.d.ts
(2,34): error TS2307: Cannot find module 'rc-select'.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/select/index.d.ts
(38,17): error TS7006: Parameter 'value' implicitly has an 'any' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/icon/index.d.ts
(5,16): error TS7006: Parameter 'e' implicitly has an 'any' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/form/Form.d.ts
(48,30): error TS7019: Rest parameter 'args' implicitly has an 'any[]' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/date-picker/index.d.ts
(11,29): error TS7006: Parameter 'trigger' implicitly has an 'any' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/breadcrumb/Breadcrumb.d.ts
(7,19): error TS7006: Parameter 'route' implicitly has an 'any' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/breadcrumb/Breadcrumb.d.ts
(7,26): error TS7006: Parameter 'params' implicitly has an 'any' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/breadcrumb/Breadcrumb.d.ts
(7,34): error TS7006: Parameter 'routes' implicitly has an 'any' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/breadcrumb/Breadcrumb.d.ts
(7,42): error TS7006: Parameter 'paths' implicitly has an 'any' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/back-top/index.d.ts
(4,16): error TS7006: Parameter 'event' implicitly has an 'any' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/alert/index.d.ts
(16,16): error TS7006: Parameter 'event' implicitly has an 'any' type.

ERROR in /home/vagrant/apps/r0/node_modules/antd/lib/auto-complete/index.d.ts
(24,17): error TS7006: Parameter 'value' implicitly has an 'any' type.

@AlbertZheng
Copy link
Contributor

BTW, the four apis are missing in the d.ts file of notification component of antd 2.0.1 when migrated from antd 1.11.x to 2.0.1:

notification.success(config)
notification.error(config)
notification.info(config)
notification.warn(config)

@lock
Copy link

lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.