Skip to content

@ory/kratos typescript API 25.4.0 adds strange "UnknownDefaultOpenApi" von Enums breaking typing #452

@finsterwalder

Description

@finsterwalder

Preflight checklist

Ory Network Project

No response

Describe the bug

I just tried to upgrade @ory/kratos to version 25.4.0.
This produces typing errors in code that worked fine with 1.3.8.
One of the culprits is, that ContinueWithVerificationUi is no longer assignable to ContinueWith.
This is strange.
Digging into it, I found that the ContinueWithVerificationUiActionEnum has a strange definition:

export const ContinueWithVerificationUiActionEnum = {
ShowVerificationUi: 'show_verification_ui',
UnknownDefaultOpenApi: '11184809'
} as const;

And there are many more that have "UnknownDefaultOpenApi" things.

Looks like a generation error to me.

Here is the concrete error I get:

error TS2677: A type predicate's type must be assignable to its parameter's type.
Type 'ContinueWithVerificationUi' is not assignable to type 'ContinueWith'.
Type 'ContinueWithVerificationUi' is not assignable to type '{ action: "show_verification_ui"; } & ContinueWithVerificationUi'.
Type 'ContinueWithVerificationUi' is not assignable to type '{ action: "show_verification_ui"; }'.
Types of property 'action' are incompatible.
Type 'ContinueWithVerificationUiActionEnum' is not assignable to type '"show_verification_ui"'.
Type '"11184809"' is not assignable to type '"show_verification_ui"'.

33 const isContinueWithVerificationUi = (continueWith: ContinueWith): continueWith is ContinueWithVerificationUi => {

Reproducing the bug

run type checking on my typescript code.

Relevant log output

Relevant configuration

Version

25.4.0

On which operating system are you observing this issue?

None

In which environment are you deploying?

None

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions