huruji / JDS_weekly

:tada:收藏大家分享的文章:bookmark_tabs:、电影:video_camera:、音乐:musical_note:、网站:feet: and others,成为一个有趣的人很难,但我们在努力。
5 stars 0 forks source link

Typescript + React 项目记录 #9

Open huruji opened 5 years ago

huruji commented 5 years ago

react-router-dom 占位路径报错 Property 'match' does not exist on type 'Readonly<{children?:ReactNode}> & Readonly'

https://github.com/DefinitelyTyped/DefinitelyTyped/issues/17355

https://stackoverflow.com/questions/50117006/reactjs-ts-property-match-does-not-exist-on-type-readonlychildrenreactno

Quilljou commented 5 years ago

UI组价库的 devDependencies,peerDependencies, dependencies UI 组件库依赖的框架(Vue, react)应该作为 peerDependencies, 同时也需要作为 devDependencies dependencies 应该只有组件库真正在生产环境依赖的库

huruji commented 5 years ago

循环固定次数,如12次,不要使用new Array(12).map,应该是使用Array.from({length:12}),empty的array根本不走map image

huruji commented 5 years ago

typescript中如何使用react的refs

https://stackoverflow.com/questions/33796267/how-to-use-refs-in-react-with-typescript

https://medium.com/@martin_hotell/react-refs-with-typescript-a32d56c4d315

Quilljou commented 5 years ago

Array.from, Map, String.prototype.startswith 这些作为标准库的一部分, ts 不编译是正常行为,需要我们自己引入垫子,class, () => 这种新语法就可以被正常编译