feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
15.02k stars 745 forks source link

json-schema-to-ts v2.8.0 produces typescript error TS2590 #3168

Closed psi-4ward closed 11 months ago

psi-4ward commented 1 year ago

@feathersjs/schema references json-schema-to-ts@^2.7.2 which resolves to the newly released v2.8.0

$ npm run compile

> feathers@0.0.0 compile
> shx rm -rf lib/ && tsc

node_modules/json-schema-to-ts/lib/types/index.d.ts:16:314 - error TS2590: Expression produces a union type that is too complex to represent.

16 export declare type FromExtendedSchema<E extends JSONSchema7Extension, S extends ExtendedJSONSchema<E>, Opt extends FromExtendedSchemaOptions<E> = FromSchemaDefaultOptions, W extends $ExtendedJSONSchema7<E> = Cast<S extends Record<string | number | symbol, unknown> ? Writable<S> : S, $ExtendedJSONSchema7<E>>> = FromSchema<Cast<UnextendJSONSchema7<E, W>, JSONSchema>, Opt>;
                                                                                                                                                                                                                                                                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/json-schema-to-ts/lib/types/index.d.ts:16

Tested with new cli scaffold 5.0.4

npm create feathers@latest feathers
Need to install the following packages:
  create-feathers@5.0.4
Ok to proceed? (y)
... // TypeScript; KoaJS; REST; realtime; npm; no client; TypeBox; other database
labrillance commented 1 year ago

For those who encounter the problem, a hotfix is to simply install at the same level as the feathers libraries

"json-schema-to-ts": "2.7.2" @feathersjs/schema will use this version and you won't have the problem anymore until json-schema-to-ts is fixed

daffl commented 1 year ago

In v5.0.5 this is also fixed in newly generated apps via #3180