fern
fern copied to clipboard
[Bug] Compile issue in generated typescript files
Describe the bug
I'm trying to use the typescript-sdk
generator. Everything worked fine so far, however I get a syntax/compile issue in the entries.ts
file:
> src/sdk/core/schemas/utils/entries.ts:2:27 - error TS2769: No overload matches this call.
> Overload 1 of 2, '(o: { [s: string]: T[keyof T]; } | ArrayLike<T[keyof T]>): [string, T[keyof T]][]', gave the following error.
> Argument of type 'T' is not assignable to parameter of type '{ [s: string]: T[keyof T]; } | ArrayLike<T[keyof T]>'.
> Type 'T' is not assignable to type 'ArrayLike<T[keyof T]>'.
> Overload 2 of 2, '(o: {}): [string, any][]', gave the following error.
> Argument of type 'T' is not assignable to parameter of type '{}'.
>
> 2 return Object.entries(object) as [keyof T, T[keyof T]][];
> ~~~~~~
>
> src/sdk/core/schemas/utils/entries.ts:1:25
> 1 export function entries<T>(object: T): [keyof T, T[keyof T]][] {
> ~
> This type parameter might need an `extends ArrayLike<T[keyof T]>` constraint.
> src/sdk/core/schemas/utils/entries.ts:1:25
> 1 export function entries<T>(object: T): [keyof T, T[keyof T]][] {
> ~
> This type parameter might need an `extends { [s: string]: T[keyof T]; } | ArrayLike<T[keyof T]>` constraint.
> src/sdk/core/schemas/utils/entries.ts:1:25
> 1 export function entries<T>(object: T): [keyof T, T[keyof T]][] {
> ~
> This type parameter might need an `extends {}` constraint.
To Reproduce Steps to reproduce the behavior:
- Setup a fern project with the following config:
default-group: local
groups:
local:
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.8.13
output:
location: local-file-system
path: ../generated/typescript
config:
outputSourceFiles: true
includeCredentialsOnCrossOriginRequests: true
- Use the attached OpenAPI spec: openapi.yml.zip
- Generate the client and try to use the SDK client
Expected behavior No such compile/syntax errors
Versions
- Fern CLI: 0.16.3
- Generator: fernapi/[email protected]
I managed to fix the affected files manually (quick and dirty):