Skip to content

Narrow types of observables in conditions #132

@tscpp

Description

@tscpp
import * as ko from 'knockout'

export default {
  name: ko.observable<string | undefined>(),
};
<!-- ko if: name() !== undefined -->
  Hello <span data-bind="text: name()"></span>!
                               ^
                               "string | undefined" is not assignable to "string"
<!-- /ok if -->

Metadata

Metadata

Assignees

Labels

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions