When exactOptionalPropertyTypes: true is enabled (e.g. via @tsconfig/strictest), better-call@1.1.8's OpenAPIParameter type causes type errors for plugins that emit format?: undefined in their OpenAPI parameter metadata.
The issue is in dist/openapi.d.mts (and .d.cts):
schema?: {
type: OpenAPISchemaType;
format?: string; // should be `format?: string | undefined`
};
Under exactOptionalPropertyTypes, format?: string means the property can be absent but if present must be string — it cannot be undefined. Plugins like @better-auth/oauth-provider generate endpoint types where format is explicitly undefined, producing:
Type 'undefined' is not assignable to type 'string'
PR better-auth/better-auth#6502 fixed this class of issue for the OIDC and JWT plugins, but better-call's OpenAPIParameter type still has the same problem, which surfaces through oauth-provider's oauth2Authorize endpoint.
Fix: Change format?: string to format?: string | undefined in the OpenAPIParameter interface.
When
exactOptionalPropertyTypes: trueis enabled (e.g. via@tsconfig/strictest),better-call@1.1.8'sOpenAPIParametertype causes type errors for plugins that emitformat?: undefinedin their OpenAPI parameter metadata.The issue is in
dist/openapi.d.mts(and.d.cts):Under
exactOptionalPropertyTypes,format?: stringmeans the property can be absent but if present must bestring— it cannot beundefined. Plugins like@better-auth/oauth-providergenerate endpoint types whereformatis explicitlyundefined, producing:PR better-auth/better-auth#6502 fixed this class of issue for the OIDC and JWT plugins, but
better-call'sOpenAPIParametertype still has the same problem, which surfaces throughoauth-provider'soauth2Authorizeendpoint.Fix: Change
format?: stringtoformat?: string | undefinedin theOpenAPIParameterinterface.