-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
correct and improve typescript definitions #274
Conversation
packages/next/src/index.tsx
Outdated
type?: T | ||
name?: string | ||
editable?: boolean | ||
['x-props']?: T extends keyof InternalFieldTypes ? InternalFieldTypes[T] : any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的所有类型,能不能挪到./types.ts里去,全部放在一起,不方便维护
packages/core/src/form.ts
Outdated
return | ||
} | ||
const published = this.publishState() | ||
reducer(published, reducer) | ||
callback(published, callback) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里有bug,不应该再传callback进去,应该是我当时写的手误
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里我看到的时候也比较疑惑,原来如此
@@ -85,6 +85,8 @@ export class Form { | |||
private traverse: (schema: ISchema) => ISchema | |||
|
|||
constructor(opts: IFormOptions) { | |||
this.getFieldState = this.getFieldState.bind(this) | |||
this.getFormState = this.getFormState.bind(this) | |||
this.options = defaults<IFormOptions>(opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用箭头函数不能重载么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
箭头函数是property不是method,不能重载
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能不能不用重载,用bind的形式,感觉不够优雅😂
packages/antd/src/index.tsx
Outdated
import { TimePickerProps } from 'antd/lib/time-picker' | ||
import { TransferProps } from 'antd/lib/transfer' | ||
import { IUploaderProps } from './fields/upload' | ||
import { SelectProps } from 'antd/lib/select' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
将依赖的类型统一放到./types.ts中吧,不然很难维护
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janryWang done
wrapperCol?: ColProps | number | ||
labelCol?: ColProps | number | ||
labelTextAlign?: TextAlign | ||
size?: Size | ||
style?: React.CSSProperties | ||
} | ||
|
||
export interface IFormItemGridProps { | ||
cols?: Array<number | { span: number; offset: number }> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cols?: Array<number | { span: number; offset: number }>
改成
cols?: (number | ColSize)[]
会不会好点?
IFormAction
andIAsyncFormAction
typesSchemaForm
type definitions add types forField
x-props
type infer ofField
when type is internal