Skip to content

Fix the typescript type of the value attribute of a-range-picker #4607

@Fallsleep

Description

@Fallsleep

Version

2.2.6

Environment

win10, vue3

Reproduction link

https://github.com/Fallsleep/ant-design-vue-test

Steps to reproduce

git clone git@github.com:Fallsleep/ant-design-vue-test.git
yarn
yarn dev
yarn build

What is expected?

a-range-picker组件的value属性的typescript类型可以和Moment匹配。

What is actually happening?

目前a-range-picker组件的value属性的typescript类型和Moment的类型无法匹配,开发时能正常访问,VSCode会提示ts(2322)类型不匹配的错误,但是执行vue-tsc --noEmit && vite build进行编译时就这个错误就无法通过了,错误信息如下:

yarn build
yarn run v1.22.4
warning package.json: No license field
$ vue-tsc --noEmit && vite build
src/App.vue(4,15): error TS2322: Type '{ format: (format?: string | undefined) => string; startOf: (unitOfTime: StartOf) => Moment; endOf: (unitOfTime: StartOf) => Moment; add: { (amount?: DurationInputArg1, unit?: DurationConstructor | undefined): Moment; (unit: DurationConstructor, amount: string | number): Moment; }; ... 84 more ...; propertyIsEnumera...' is not assignable to type 'RangePickerValue | undefined'.
Type '{ format: (format?: string | undefined) => string; startOf: (unitOfTime: StartOf) => Moment; endOf: (unitOfTime: StartOf) => Moment; add: { (amount?: DurationInputArg1, unit?: DurationConstructor | undefined): Moment; (unit: DurationConstructor, amount: string | number): Moment; }; ... 84 more ...; propertyIsEnumera...' is not assignable to type 'undefined[]'.
Type '{ format: (format?: string | undefined) => string; startOf: (unitOfTime: StartOf) => Moment; endOf: (unitOfTime: StartOf) => Moment; add: { (amount?: DurationInputArg1, unit?: DurationConstructor | undefined): Moment; (unit: DurationConstructor, amount: string | number): Moment; }; ... 84 more ...; propertyIsEnumera...' is not assignable to type 'undefined'.
error Command failed with exit code 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions