ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.02k stars 1.28k forks source link

Getting an error Type error: Type parameter declaration expected. 🐛[BUG] #8217

Open bvzgame opened 1 month ago

bvzgame commented 1 month ago

Failed to compile. ./node_modules/@ant-design/pro-form/es/components/FormItemRender/index.d.ts:24:41 Type error: Type parameter declaration expected. 22 | }[]> = T[number]['name']; 23 | export declare function useControlModel({ value, onChange, id }: WithControlPropsType, model?: T): ControlModelType;

24 | export declare function useControlModel<const T extends readonly string[]>({ value, onChange, id }: WithControlPropsType, model?: T): { | ^ 25 | [P in T[number]]: ControlModelType; 26 | }; 27 | export declare function useControlModel<const T extends readonly FormControlMultiProps[]>({ value, onChange, id }: WithControlPropsType, model?: T): { -----> Build failed

image

Note this is using heroku

any ideas?

IcePear17 commented 1 month ago

Probably a ts version issue,‘const T’ needs ts version 5.0 or later.

blessdarah commented 1 month ago

I also happen to have this issue after building for deployment. I'm using @ant-design/pro-components version ^2.6.49 for Antd version 5.2.1. Has anyone been able to build for production?

DuyVoK15 commented 1 month ago

I also happen to have this issue after building for deployment. I'm using @ant-design/pro-components version ^2.6.49 for Antd version 5.2.1. Has anyone been able to build for production?

Try to update Typescript v5.0 or later

blessdarah commented 1 month ago

@DuyVoK15 I have tsc 5.4.2 already installed.

AlbertXiaoPeng commented 1 week ago

Probably a ts version issue,‘const T’ needs ts version 5.0 or later.

It's the right one. Solved my problem.