TypeScript
@types/react@18
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/56210
react 18去除了 props 中隐含的 children,造成了break changing
Removal of implicit children
For components that do implement children but relied on their implicit declaration from React.FunctionComponent or React.Component:
interface Props {
+ children?: React.ReactNode;
}
class SomeClassComponents React.Component<Props> {
render() {
return <div>{this.props.children}</div>
}
}
const SomeFunctionComponent: React.FunctionComponent<Props> = props => <div>{props.children}</div>
Please check Removal Of Implicit Children for the rationale.
I may have a solution to bring these back on-demand without patching the published types (watch #59751)
另外有这些类型被剔除,有的已有可替代类型
-StatelessComponent
+FunctionComponent
-SFC
+FC
-React.ReactType
+React.ElementType
-SFCElement
+FunctionComponentElement
// no replacement
-Props
-RefForwardingComponent
-SFCFactory
Tools
rome
prettier替代
https://rome.tools/blog/2022/04/05/rome_formatter_release
JavaScript
node:xxx
import { join } from 'node:path'
引用地址增加 node 前缀
Debug
antd form
该属性置为 false 后存在一个效果(副作用?),若当前表单域删除后再显示,表单域会使用 initialValue,猜测这才是这个api的真实用途?
所以存在一个情况,如果当前表单域在隐藏再显示的过程中更换了内部组件,肯定是不希望再使用原先的 intialValue 的,这就造成了异常。或 当前表单域已被修改,隐藏再显示后又为初始值,这样的效果实际也比较奇怪,所以该 api 设计比较奇怪,或只是不应该是这样的说明。