Skip to content

Seems like a bug, complains about property type #30081

@al6x

Description

@al6x

Code

This code won't compile

export type Errors<D> = {
  readonly [K in (keyof D | 'base')]?: string[]
}

class Model<D> {
  getErrors(): Errors<D> {
    return { base: ['some base error'] }
  }
}

Expected behavior:

It should compile without errors

Playground

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Mapped TypesThe issue relates to mapped types

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions