Skip to content

Bug: readonly string field not inferred as literal type #677

@marvinhagemeister

Description

@marvinhagemeister

Reported on discord: https://discord.com/channels/684898665143206084/1203185670508515399/1270065229497106565

I believe I found a bug with JSR's dts generation. namely, readonly string fields in classes don't get correctly inferred as literal types

// input
class DocNotFound extends Data.Error {
  readonly _tag = "DocNotFound"
}

// generated type:
class DocNotFound extends Data.Error {
  readonly _tag: string
}

// expected:
class DocNotFound extends Data.Error {
  readonly _tag: "DocNotFound"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    d.ts generationrelated to generation of d.ts for non-deno targets

    Type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions