pro-components icon indicating copy to clipboard operation
pro-components copied to clipboard

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

Open bvzgame opened this issue 11 months ago • 8 comments

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<T extends FormControlProps>({ 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?

bvzgame avatar Mar 08 '24 04:03 bvzgame

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

IcePear17 avatar Mar 11 '24 07:03 IcePear17

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?

blessdarah avatar Mar 19 '24 07:03 blessdarah

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

DuyVoK15 avatar Mar 19 '24 12:03 DuyVoK15

@DuyVoK15 I have tsc 5.4.2 already installed.

blessdarah avatar Mar 19 '24 14:03 blessdarah

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

It's the right one. Solved my problem.

AlbertXiaoPeng avatar Apr 18 '24 02:04 AlbertXiaoPeng

I'm running into this issue as well using the latest version of pro-components (2.7.11) and typescript (5.5.2). I've also tried pinning to lower versions of typescript v5, like 5.3.3 referenced in the lockfile, but the same errors are present when building.

I'm seeing 20 cases of these, all coming from @ant-design/pro-form/es/components/FormItemRender/index.d.ts:

  • 24:41 - error TS1139: Type parameter declaration expected.
  • 24:49 - error TS1005: ',' expected.
  • 24:129 - error TS1109: Expression expected.
  • 24:133 - error TS1128: Declaration or statement expected.

Any ideas?

sethmcleod avatar Jun 27 '24 16:06 sethmcleod

I have the same problem. Any ideas?

jucieltonsantos2244 avatar Aug 05 '24 15:08 jucieltonsantos2244

I'm running into this issue as well using the latest version of pro-components (2.7.11) and typescript (5.5.2). I've also tried pinning to lower versions of typescript v5, like 5.3.3 referenced in the lockfile, but the same errors are present when building.

I'm seeing 20 cases of these, all coming from @ant-design/pro-form/es/components/FormItemRender/index.d.ts:

  • 24:41 - error TS1139: Type parameter declaration expected.
  • 24:49 - error TS1005: ',' expected.
  • 24:129 - error TS1109: Expression expected.
  • 24:133 - error TS1128: Declaration or statement expected.

Any ideas?

我安装5.5.4版本的可以

catmiao8 avatar Sep 09 '24 08:09 catmiao8