Skip to content

interfaces and type aliases behave differently on optional fields #301

@gcanti

Description

@gcanti

interface IteratorResult from lib/core.js

interface IteratorResult<T> {
  done: boolean;
  value?: T;
}

// error: property value Property not found in IteratorResult
var x: IteratorResult = {done: true};

conversely this works fine:

type IteratorResult<T> = {
  done: boolean;
  value?: T;
};

// ok
var x: IteratorResult = {done: true};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions