Skip to content

Indexed read from dictionary not considered potentially undefined under strictNullChecks #12287

Closed
@Jessidhia

Description

@Jessidhia

With typescript@master:

// with "strictNullChecks": true
interface A {
  [key: string]: string
}
const x: A = {}
const b = x['undefined']
// b is string instead of string | undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions