N
Neon13mo ago
sensitive-blue

Possible type problem on the client

const neonDatabase = await neonApiClient.POST("/projects", {
body: {
project: {
name: newBusinessId,
pg_version: 17,
region_id: "aws-us-east-1",
// Type error here
default_endpoint_settings: {
autoscaling_limit_max_cu: 0.25,
autoscaling_limit_min_cu: 0.25,
},
},
},
})
const neonDatabase = await neonApiClient.POST("/projects", {
body: {
project: {
name: newBusinessId,
pg_version: 17,
region_id: "aws-us-east-1",
// Type error here
default_endpoint_settings: {
autoscaling_limit_max_cu: 0.25,
autoscaling_limit_min_cu: 0.25,
},
},
},
})
Type '{ autoscaling_limit_max_cu: number; autoscaling_limit_min_cu: number; }' is not assignable to type '{ pg_settings?: { [key: string]: string; } | undefined; pgbouncer_settings?: { [key: string]: string; } | undefined; autoscaling_limit_min_cu?: number | undefined; autoscaling_limit_max_cu?: number | undefined; suspend_timeout_seconds?: number | undefined; } & { ...; }'. Type '{ autoscaling_limit_max_cu: number; autoscaling_limit_min_cu: number; }' is not assignable to type '{ [key: string]: string; }'. Property 'autoscaling_limit_max_cu' is incompatible with index signature. Type 'number' is not assignable to type 'string'.ts(2322) neon-types.ts(1653, 9): The expected type comes from property 'default_endpoint_settings' which is declared here on type '{ settings?: { quota?: { active_time_seconds?: number | undefined; compute_time_seconds?: number | undefined; written_data_bytes?: number | undefined; data_transfer_bytes?: number | undefined; logical_size_bytes?: number | undefined; } | undefined; allowed_ips?: { ...; } | undefined; enable_logical_replication?: boo...' (property) default_endpoint_settings?: ({ pg_settings?: components["schemas"]["PgSettingsData"]; pgbouncer_settings?: components["schemas"]["PgbouncerSettingsData"]; autoscaling_limit_min_cu?: components["schemas"]["ComputeUnit"]; autoscaling_limit_max_cu?: components["schemas"]["ComputeUnit"]; suspend_timeout_seconds?: components["schemas"]["SuspendTimeoutSeconds"]; } & { ...; }) | undefined
1 Reply
sensitive-blue
sensitive-blueOP13mo ago
i used this command to generate the types "tenant-db-api:generate": "pnpm dlx openapi-typescript https://neon.tech/api_spec/release/v2.json -o ./src/libs/neon-toolkit/neon-types.ts",

Did you find this page helpful?